How to bypass required fields for submit button

A common task I have encountered is to create a stage that will be used for saving a user’s progress. The built-in Save as Draft functionality only allows the user to save one instance of a form. By creating your own stage as part of your workflow there is no limitation on the number of forms that the user may have in progress.

Submit buttons will not allow a form to be submitted if there are empty required fields, which poses a problem for out Save button.

To get around this we can do the following:

1. Add a checkbox to your form (that will be hidden).

2. Add javaScript to the save progress button that sets the value of the checkbox. If you are using a stage button then the code will go in the validateButtonPressed event and look like this:

 

//toggle check that will disable required fields. if(pActionId === “S_StartToDraft” || pActionId === “S_DraftUpdate”) { BO.F_ReqFieldFlag.setValue(true); }

 

3. Add javaScript to clear the value of the checkbox in the onLoad event (this resets the flag)

4. Instead of using the Asterisk to mark a field as required create a rule that sets the fields to required if the checkbox is checked.

 

By using this technique the user will be able to save the form into your custom “draft” stage. Note: You should be able to use 1 rule to set all the required fields based on the value of the checkbox.

Attached is a sample form that demonstrates the functionality, click the paper clip at the top of the article to download it.