silverstripe / silverstripe-userforms

UserForms module provides a visual form builder for the Silverstripe CMS. No coding required to build forms such as contact pages.
BSD 3-Clause "New" or "Revised" License
135 stars 225 forks source link

Option to allow navigating from a step without completing all required fields #1301

Open purplespider opened 4 months ago

purplespider commented 4 months ago

Description

Currently, on a multistep form with required fields, a user cannot progress to the next step unless they have completed all the required fields on the current step.

This can be frustrating for users, as they cannot click through all the steps to first check what data is required before starting to complete the form.

It would be nice to have an option that disables field validation for the current step when switching to a different step.

Looking through the code, this should be relatively easy to implement, as it already allows you to jump to a "viewed" step, if the current step is invalid. It looks like the following changes would be required:

  1. If this option is enabled, skip the check on line 643
  2. After jumping to a step from a link in error-container, trigger validation. (If a user attempts to submit a form with validation issues, it already presents a list of links to steps with issues, but when clicking one of these steps, it should ideally highlight the invalid fields by initiating validation.)

If the above sounds ok, I'd be happy to give this a bash, but will need some basic pointers on getting the tooling up and running. Thanks!

Additional context or points of discussion

No response

Validations

GuySartorelli commented 3 months ago

Sounds sensible. It should probably be an opt-in and target the next minor release (i.e. the 6 branch).

There's docs about setting up and using build tooling in https://docs.silverstripe.org/en/5/contributing/build_tooling/, and most everything else you should need to know is in https://docs.silverstripe.org/en/5/contributing/code/ - but let me know if you get stuck and I'll see how I can help.