1

I have custom requirement on the sitecore forms as below. Building a form with multiple pages and for instance a field in page 4 has to be mandatory based on the dropdown selected on page 1.

So sitecore doesnot OOTB provide this feature. I was trying to get this done using the jquery but no luck there as well

Has anyone tried this before? Any other alternative will be highly helpful

Thanks

1
  • Hi @Mamtha, how is it going, is it helpful to further dig into this issue?
    – Alexander
    Aug 17, 2023 at 5:38

2 Answers 2

1

You can follow the steps outlined in the blog Sitecore Forms Conditional Validation Part 2 & Sitecore Forms Conditional Validation - Part 1

As mentioned,when you submit one page of the form, Sitecore Forms stores the values you entered in session.In hence,we are able to read those values on the next page. You can implement multi-page form conditional logic in Sitecore Forms by combining client-side and server-side validation.

You can create an extension method that returns the value stored in the session for a field. Then, create a custom validation class that in which you can access the values from other pages using the extension method and perform the necessary validation.

Hope it helps!

0

You can

  • place the conditionally required field inside a section which will be show only if certain value of the dropdown is selected: enter image description here

  • on the field itself, only enable the field if that certain value of the dropdown is selected:

enter image description here

Now if there dropdown has certain value selected, field will be shown and will be required. If there is anything else selected in the dropdown, field won't be shown and as it's disabled, it won't be considered as required.

1
  • We have already implemented this. The need is to make this happen across different form pages. Meaning, the dropdown is in one page and the field is on another page of sitecore forms
    – Mamtha
    Aug 8, 2023 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.