cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Javascript function is calling before the Default validation returns during onclick of "Save" in Nintex forms

Hi ,

I am having a Nintex form, where I am using a javascript confirmation dialog in onclick of "Save" button. While I try to submit the form without filling the mandatory fields, the confirmation dialog is coming and then it is showing the requried field error message.

My requirement is Confirmation dialog should come onclik on "Save" button, once the require field validation gets succeeded and items gets added to the list.

How can I achieve this?

Thanks,

Sri

0 Kudos
Reply
6 Replies
Workflow Hero

Re: Javascript function is calling before the Default validation returns during onclick of "Save" in Nintex forms

Hello Srividhya Jeeva​,

I believe what you'd want to do is evaluate the nf-validation-summary CSS class and only perform your JavaScript pop-up if the validation is not displayed.

NWF$(document).submit(function ()

NWF$(document).submit(function () {

    if (NWF$('.nf-validation-summary').css('display') == 'none') {

        // If form validation succeeds, perform your JavaScript here.

    }

});

Although the above snippet is wrapped in the NWF$(document).submit(function () {...} function, calling your code this way is optional. The important piece is the if statement. Good luck!

Here's a similar thread for reference : Execute javascript code after nintex form validation completes

Accept as Solution Reply
Not applicable

Re: Javascript function is calling before the Default validation returns during onclick of "Save" in Nintex forms

Hello Patrick,

I tried as you mentioned above, but my custom javascript is not working, eventhough the validation succeeds. But I just test with an alert function it is working fine only.

Sri.

Accept as Solution Reply
Workflow Hero

Re: Javascript function is calling before the Default validation returns during onclick of "Save" in Nintex forms

Sri – Can you share your JS?

Accept as Solution Reply
Not applicable

Re: Javascript function is calling before the Default validation returns during onclick of "Save" in Nintex forms

Hi Patrick,

As I said earlier, Javascript is calling before the required field validation works, even though I called my javascript function inside

  1. NWF$(document).submit(function () { 
  2.     if (NWF$('.nf-validation-summary').css('display') == 'none') { 
  3.         // My Javascript Function
  4.     } 
  5. });
Accept as Solution Reply
Workflow Hero

Re: Javascript function is calling before the Default validation returns during onclick of "Save" in Nintex forms

Hi

  Did you able to resolve the issue ?

Thanks,

Rahul

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Javascript function is calling before the Default validation returns during onclick of "Save" in Nintex forms

Well, running across this certainly worked for me!

I'm triggering my workflow conditionally (as there are different types of submission buttons) so this worked for me:

NWF$(document).submit(function () { 
if (NWF$('.nf-validation-summary').css('display') == 'none') { 
NWF$('#' + fldStatus).val("Yes").trigger('change');

}); 

(Green is where I put my own code. I don't know JavaScript so this took some efforts on my behalf... haha.)

0 Kudos
Accept as Solution Reply