Pages

Thursday, January 5, 2017

Nintex Confirmation pop up window after validation and Form Submit

Issue:
While I try to submit the Nintex 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.

Solution:

Add in the following javascript code in the Custom Javascript area on the settings page then the pop up will appear, once the form will be submitted.

NWF$(document).submit(function () { 
    if (NWF$('.nf-validation-summary').css('display') == 'none') { 
      alert("Form Submitted Successfully");
    }
else
{
alert("Please Fill all Mandatory fields");
});



7 comments:

  1. Exactly what I needed. Thank you

    ReplyDelete
  2. Nice solution but also gives the same message when you click cancel button, not ideal.

    ReplyDelete
  3. I used his code with some other code to choose if a cancle or save button was used. Here's how in three steps...Use a variable to set if the cancel button was used.
    1) declare a global variable in the document ready. I used canclebuttonused as the variable.

    NWF$(document).ready(function() {
    cancelbuttonused = 'false';
    };

    2) In the click function of the cancel button change the vaiable to true.
    function cancelAndClose()
    {
    NWF$('.cancelButton').click();
    cancelbuttonused = 'true';
    };

    3)Use if statement to check if the cancel button was used:
    NWF$(document).submit(function () {
    console.log("CancelButton value: " + cancelbuttonused);
    if (cancelbuttonused == 'false') {
    if (NWF$('.nf-validation-summary').css('display') == 'none') {
    alert("Form Submitted Successfully");
    }else{
    alert("Please Fill all Mandatory fields");
    };
    }else{
    alert("Cancel was choosen. Closing Window");
    window.open('javascript:window.open("", "_self", "");window.close();', '_self');
    };
    });

    ReplyDelete
    Replies
    1. Oh I also change the variable value if the save button was used.
      function cancelAndClose()
      {
      NWF$('.cancelButton').click();
      cancelbuttonused = 'true';
      };

      And I forgot to mention that I configured the 'Client Click' with the names of the functions. So the cancel button client click was cancelandclose.
      The save button client click was cancelAndClose

      Delete
  4. you can achieve what you want by saving the same script to the SAVE button (under Control Settings -> Advanced -> Client Click), instead of saving it to the Forms Settings.

    ReplyDelete
  5. Hi I now this is a old topic but very nice, however do you have any suggestion to do this kind of alert when I'd like to compare 2 fields is the same? I'm trying to validate a form where the Requester can't be the approval user too.

    If I'm a requester I need to select another approval for the form, even I'm a member of the approval list.If I slecect I approve the form need display on pop up waring "The requestar can't be the same of the approval, please select another approval".

    Do you have any suggestion?

    Regards

    ReplyDelete