Scenario: A form has required fields. However, if the user presses a button like Reject, we don't want to require the user to fill in junk data, especially if a required field is a File Upload field.
Goal: Skip validation if the user presses "Reject".
Steps:
- Disable backend validation on the form in question
- On the Forms Layout tab, press the gear icon, set Backend validation to "No validation"
- Save
- Add the following jquery
$(document).ready(function (){ // this binds a click action on the Reject button $('input.action-btn.ellipsis.Reject').on('click', function() { $('input, select').each(function() { $(this).removeAttr('required'); }); }); });
Result: When the users clicks the Reject form action, no validation takes place. and the Reject action path is taken in the process model. All other actions, live validation takes place and prevents the action from going through.
I've been trying to work this but didn't find an exact post. Was writing something up to save for myself and figured I'd save it here instead :) Many thanks to @Matthew Tingey for putting me down the right path based on his post https://answers.laserfiche.com/questions/141193/check-validation-before-submit#141201 .
Forms Version 10.3.1.553