Save and Continue with Validation

  • 1 February 2019
  • 2 replies
  • 251 views

Badge +8

I saw a number of posts on this topic with no real clear solution.   I would like to present my solution here.   It is based on the work of a number of people on this forum.

 

But first I would like to state that  it is beyond comprehension why Nintex does not have the option to validate before Save and Continue right out of the box.   We should not have to come up with a hack for something that common sense says should  have been a part of the original design.

 

Now for the solution.

 

1. Place a Save and Continue button on your form.

 

2. Give it a class names something like SaveAndContinueXYZZY.  You should be able to store the ID in a JavaScript variable but yet another thing beyond comprehension is why this feature is not available for buttons.   It is probably a good idea to take the extra step of using your own class as opposed to using  what Nintex provides because if they change their design then your form will still work.

 

3.  Hide this button with a rule.  Remember to turn off the  appearance on the ribbon for this button.

 

4.   Place the code at the bottom of this blog in the JavaScript section of the form properties or in an include file and reference the file in your properties.

 

5.  Place a JavaScript button on your form.  Label it Save and Continue.   Place the saveAndContinue() function in the Client Click property of the button.

 

P.S.  You will notice the isPageValid function calls the Nintex provided Page_ClientValidate function.   I had to do this because I have never been able to get the Causes Validation feature to actually validate on JavaScript buttons.    

 

 

function isPageValid()
 {   
      if (Page_ClientValidate())
     {
      return true; 
     }
     else
      {       
       alert("The form is incomplete.  Press OK then scroll to the top of the form to see what fields need to be completed.");
       return false;           
      }   
 }
       
    
   function saveAndContinue()
   {    
    if (isPageValid())           
    NWF$(".SaveAndContinueXYZZY").click();
       
   }  


2 replies

Badge +7

Thank you! Works to a point in that it doesn't highlight the empty fields. Still it's better than nothing!

Badge +4

Perfect thanks!

Reply