cancel
Showing results for 
Search instead for 
Did you mean: 
aishuiyer
Nintex Newbie

how to produce an alert pop up message when user enters invalid input before submitting the form?

I have written the following code

can anyone tell me where am I going wrong?

NWF$(document).ready(function()

 {  
   var  fromShortcode = NWF$("#" + choiceCode);
   var  toShortcode = NWF$("#" + shortCode);
   var dp1 = fromShortcode.val();

    NWF$('#' + shortCode).change(function()
 {
  alert(dp1);
  alert(toShortcode);
  if (fromShortcode == toShortcode){
 alert("same values in both the field!");
   }
  

});
 
   });

Labels: (1)
Tags (1)
0 Kudos
Reply
6 Replies
shrinivasnaik
Nintex Newbie

Re: how to produce an alert pop up message when user enters invalid input before submitting the form?

This code will run when the document first loads and not just before the user clicks on any submit button? Is that what you want?

0 Kudos
Reply
aishuiyer
Nintex Newbie

Re: how to produce an alert pop up message when user enters invalid input before submitting the form?

I want to generate an alert  error pop up message as soon as the if condition gets true and not after the user clicks on any submit button.

0 Kudos
Reply
shrinivasnaik
Nintex Newbie

Re: how to produce an alert pop up message when user enters invalid input before submitting the form?

Have a look at the below article on how to do a real time validation. The script you wrote above would only run once when the form is first loaded and not when the value of your control changes. I still believe Nintex as a product is there for a quick development of business solutions and sometime if you explain to your business users that validation which happens on submit are more easier in terms of development/turn around time /testing etc they might be okay for a different user experience but still giving you the same functionality. You always have the ability to extend Nintex forms by using JS.

Check below for some examples on how you could achieve real time validation.

 

Regards,

Shrini

0 Kudos
Reply
aishuiyer
Nintex Newbie

Re: how to produce an alert pop up message when user enters invalid input before submitting the form?

thank you for article.

the article shows validation when the user does not enter any input in the fields

in my case, I have a drop down list lookup, and if the user choose the same option in both the drop down list then a real time pop up message is to be generated showing 'same values in both the fields' (which is the the condition that I have given I the if statement)

It would be great if u can provide a solution for this as I'm new to nintex.

0 Kudos
Reply
shrinivasnaik
Nintex Newbie

Re: how to produce an alert pop up message when user enters invalid input before submitting the form?

Hi,

As I mentioned before this is not native to Nintex and the solution given in the above article is more of a hack into Nintex engine and not necessarily the best way to do in Nintex. If you are good in Javascript then you could use that. Instead of using the validation rule its trying to "hack" by passing the object reference back to your JS function and you could evaluate the value and trigger the validation.

If you want to use native Nintex validation then add a rule onto your Lookupcontrol for a validation rule and this will get triggered only when you try saving the form. This is probably the most easiest and native to Nintex. Be sure to use ParseLookup function when you are trying to evaluate any lookupvalue.

Regards,

Shrini

Reply
aishuiyer
Nintex Newbie

Re: how to produce an alert pop up message when user enters invalid input before submitting the form?

okay thank you!

0 Kudos
Reply