Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Save draft and skip validation

Tinka
Posts: 73
Joined: Mon Feb 24, 2014 2:58 pm

Save draft and skip validation

Unread post by Tinka »

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
Post Reply