breezingforms

Page 60

[User Guide]

[Crosstec/Breezing Forms]

Password Validation How do I make sure that my 'Password' and 'Confirm Password' text fields match? I don't see a library script to validate passwords. You can create a new library script to handle this type of validation. Here's how: 1. Go to Components > BreezingForms > Manage Scripts. 2. Click on the NEW icon in the upper right-hand corner of the screen to create a new script. 3. On the screen that opens, enter the following variables: Title: Validate password repeat Published: YES Package: FF Name: ff_password_repeat Type: Element Validation Description: Validates that two password fields match. Note: The second password field must be named "FIELDNAME_repeat" (where FIELDNAME is the name that you assigned to the first password field). 4. In the codebox text area, enter the following code:

Code: function ff_password_repeat(element, message) { if ( element.value == "" ){ if (message=='') message = element.name+" is empty.\n"; ff_validationFocus(element.name); return message; } // if try{ var repeat = element.name.split("ff_nm_")[1].split("[]")[0]; if(!ff_getElementByName(repeat + '_repeat')){ if (message=='') message = repeat+" has no repeat password field.\n"; ff_validationFocus(element.name); return message; } else { if(ff_getElementByName(repeat + '_repeat').value != element.value){ if (message=='') message = element.name+" and " + repeat + "_repeat do not match.\n"; ff_validationFocus(repeat + '_repeat'); return message;

Page 58


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.