I want to add a coupon code to my form. The code will be the same for everyone, but I don't know how to make sure they enter the right code. Can I even do that?
- Go to your form, and then to the text element that you are using for your Coupon Code field. For the purposes of this example, we're going to call the element "CouponCode" (without quotes) in the NAME field underneath the "Label" field.
- Put a checkmark in the Validation box, and then click on the radio button to the right of the word 'Custom' in the next line.
- Enter an error message (for example: "Please enter a valid coupon code").
- Click on "Create code framework." (It doesn't look like a link, but it is!) A javascript popup will appear which says:
Create code framework for validation now?
(Existing code will be appended).
Click on OK.
- In the text area that opens, delete all of the code which is currently there, and replace it with:
function ff_CouponCode_validation(element, message) { if (element.value == "ABC123") { return ''; } return 'Please enter a valid coupon code'; } // ff_CouponCode_validation
Now save the form and test it out!