Disable Form Validation When Saving Workflow as a Draft

Again, thanks Dan Huston for a great question which was this:
Is it possible to distinguish between when a workflow form is being submitted and when the user is saving it to their drafts folder?

We have times when the manager does not have certain information and therefore wants to save the form rather than submit it, but the page validation script still fires in this instance.

We certainly can disable screen validation when saving as a draft. Here is the script. As usual, see the principal behind the script and adjust as you require. You might want to have some validation of data for draft…

/**

 * SaveDraft() function is executed in workflow screen when user is saving a draft.
 * This also executes ValidatorOnSubmit() that validates all the information on the form to be consistent.
 */



//save original SaveDraft function 
var orig_saveDraft = window.SaveDraft;

//Override SaveDraft function 
window.SaveDraft = function(){

  // disable validating function
  window.ValidatorOnSubmit = function(){};
 
  // execute original SaveDraft() function
  return orig_saveDraft();
}
This entry was posted in Uncategorized and tagged , , , , , , , . Bookmark the permalink.

3 Responses to Disable Form Validation When Saving Workflow as a Draft

Leave a Reply

Your email address will not be published.