I have a use case where I would like to compare the values of two fields and display a warning message if they are not identical. Either by displaying a hidden field or by some other method.
Does anyone have a similar example?
I have a use case where I would like to compare the values of two fields and display a warning message if they are not identical. Either by displaying a hidden field or by some other method.
Does anyone have a similar example?
You can do this using JavaScript:
$(document).ready(function(){ $("#q3").hide(); $("#q1 input, #q2 input").change(function(){ if ($("#q1 input").val() != $("#q2 input").val()) { $("#q3").show(); } else { $("#q3").hide(); } }); });
Someone else may be able to provide a more elegant solution, but here's how we have handled this in a form where a username is entered, and then re-entered for verification.
We have three hidden fields.
verify_1_notblank uses the field formula: =IF(first_field <> "",1,0)
verify_2_notblank uses the field formula: =IF(second_field <> "",1,0)
accountname_verification uses the field formula: =IF(first_field=second_field,1,0)
We then display an HTML box that says "Username mismatch" using the Field Rules shown in the attached screenshot.
The "not blank" fields prevent the HTML from showing when both fields are blank, before any values are entered into the form.
I hope that helps!
Note: the screenshot shown is from v10 (or Classic Designer), but it should work the same way in the v11 Forms Designer
I think @████████'s post with hidden fields and field rules to display a warning message will be the simpliest to implement.
There are lots of examples here on Answers (like this one) about using Javascript to add custom parsley validation to the fields. These should work in version 10 (based on your tagged topic for the post).
If what you are comparing is email addresses, and this is something you do regularly, it might be worth upgrading because Forms 11 added out-of-the-box comparison of email fields in the new Forms Layout Designer.