You are viewing limited content. For full access, please sign in.

Question

Question

Skip the required field validation when submitting the Form

asked on April 18, 2016 Show version history

We have soem required fields in the form. But, when a user is rejecting the form, they need not fill out all of the required fields. Is there a way to skip this validation please?

 

Thanks

Priya

0 0

Replies

replied on April 6, 2020

Hi Priya,

I have this issue myself. What I end up doing is enabling and disabling the required fields within JS. First all the fields you toggled to be required on the layout page turn off. Then in JS you'll want to add these:

$('.classname input').attr('required','True');

$('.classname label.cf-label').append('<span class="cf-required">*</span>');

then to turn off the required use the following:

$('.classname input').removeClass('required').removeAttr('required');

$('.classname span.cf-required').remove();

Because I have a lot of fields on some of my forms, that are required, I end up making a function called toggleRequired(bool). I pass in a true on form load and then on the button click, such as 'Reject', I pass in a false in the function instead to remove all the required fields. This helped a lot for me when I have some forms that need to bounce between people and they are unable to fill in all the fields.

 

Hope that helps!

 

1 0
replied on October 26, 2022

this is an excellent solution to use instead of the default 'required' option on Layout. I'm now using this exact setup wherein answering 'yes' will load additional required questions and answering 'no' collapses and removes the requirement. thanks!

0 0
replied on April 18, 2016

You would need to have 2 forms in Form process, the one that is originally submitted and the one that is being approved/rejected. Duplicate the Starting form you had created, all the variables will come with it. You can name this similar to the first but put Approval or something at the end to identify it. You can edit this form and make those fields not needed by the user to be not required.

In your Process Diagram, in the User Task, choose this form instead of the Starting for you now have.

0 0
replied on April 18, 2016

You can have the fields hidden based on a checkbox or radio button. If the document is accepted they could check the box to show the required fields or you can reverse the method to hide fields if it will be rejected. Hopefully, I am explaingign it clearly.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.