How to validate the form only if two widget have the same value

1
0
-1

I have a form with diffirent widgets. I want to compare between two widget (PassWord and ConfirmationPW), before validate the forme and pass to next task ?

How can i do that ?

Thank you .

4 answers

1
0
-1
This one is the BEST answer!

if it is a simple string message, no need to use groovy to display it. just use a constant message. I tested your print("Error in PW") script and it doesnt show up when validation fails (but the form is not submitted). So just write "Error in PW" in Error message field.

Comments

Submitted by rahmi.hichem on Tue, 06/24/2014 - 16:21

Thank you it works :)

1
+1
-1

Check the screenshot here : http://hpics.li/178dbdd

The Error message field should contain the error message you want to be displayed when the comparison fails.

The Parameter field should contain the groovy script performing the comparison (field1.equals(field2) for example).

Comments

Submitted by rahmi.hichem on Fri, 06/20/2014 - 17:21

Actualy in message error i did :

Print("Error PW")

And in the parameter i put tho following code :

(Field_pw != Field_confPw);

Is that supposed to work ?

1
0
-1

Thank you mehdi.kettani for your answer. I did what u told me , and it works, i put in the message some groovy code like :

if (field_pw!=field_confPw) print ("Error in PW")

I still have a litle problem. When i execute my form , he shows me the following message : An element with id CréerNewUtilisateur is missing from the page template.

Just for information my process create new users.

So can you tell me how to specify my own error message ?

1
0
-1

Hi Hichem,

You can do that using a form validator (either with groovy or regular expression). When the submit button is clicked, the form validator will compare your two widgets and if they are not the same, the user will see the error message you specified. You can find the form validator in the form general menu (by clicking anywhere outside your form).

Best regards,

Mehdi

Notifications