Hi folks, I would like to validate email addresses on a form i.e. type an address in twice and validate that they are the same constructed in a propper format. Is this possible? By the way formassembly is absolutely fabulous and has blown me away big time. I am a 4 hour old member.
You can specify in the Form Builder that a field should be validated as an email, but the only way to force two fields to be identical is to use a custom javascript function.
The following instructions are recommended for expert users only.
1/ Find in the HTML source code the id attribute of the two fields you want to validate as being identical.
2/ Copy and paste the following in the "Custom Code" field in the form's advanced properties tab (in the Form Builder), make sure to set the values for fieldId and confirmFieldId.
<script type="text/javascript"> var fieldId = "enter here the id of the first field"; var confirmFieldId = "enter here the id of the confirmation field"; wFORMS.behaviors.validation.messages['isIdentical'] = "The values don't match.";
// leave the rest as is. wFORMS.behaviors.validation.rules['isIdentical'] = { selector: "#"+fieldId, check: function(element) { var c=document.getElementById(confirmFieldId); if(element.value!=c.value) { return false; } return true; }}; </script>