Save draft and skip validation

Save draft and skip validation

Postby Tinka » Tue Jul 09, 2019 5:27 pm

Hi nuBuilder users,

I want to be able to save a draft of a record before doing "the real" saving.

There are nine mandatory fields in my Edit form (Stop blanks).
I think of two approaches: either to give the mandatory fields dummy values so they pass the Stop blanks validation (and of course check if the user has put a value already), or to circumvent the Stop Blanks check.
I have been looking at nuSaveForm and nuCompleteSavingForm in nucommmon.js, but I can't figure out, how the Stop Blanks is implemented. Something with the data.errors?

I have changed my nuOnSave function in the Javascript to skip certain validations, when the record is marked as draft, and added an extra action button Save Draft with this js code:
Code: Select all
$('#var_draft').val('1');
$('#var_draft').change(); //checkbox does not change before form is saved
nuSetHash('draft','yes');
nuSaveForm();


and this part works fine.

Any ideas?

Best, Tinka
Tinka
 
Posts: 72
Joined: Mon Feb 24, 2014 11:28 pm

Return to General