Hi,
I'm trying to create a simple contact form. In the fname/lname fields, the requirements are that alphas, hypens, undescores, and apostrophes are allowed. I'm trying to use the built in regex validator option to accomplish this. The code is as follows:
Everything EXCEPT apostrophes work fine. I've tested the regex on a builder site and all the characters are matching properly there, including the apostrophes. When the form submits, the apostrophe gets changed to its HTML character respresentation when the page refreshes. I'm thinking this is what's getting run through the validator and that's why it's not working. Do couch forms automatically change special characters?
Is there a decent workaround? I've thought about just manually doing a preg_match(), but it'd be nice to keep it simple and use the built in features.
Thanks
I'm trying to create a simple contact form. In the fname/lname fields, the requirements are that alphas, hypens, undescores, and apostrophes are allowed. I'm trying to use the built in regex validator option to accomplish this. The code is as follows:
- Code: Select all
<cms:input name="lname" type="text" maxlength="100" id="lname_input" title="Enter Last Name; upper & lower case, hypen, and apostrophe only" validator="regex=/^[A-Za-z_'-]+$/" validator_msg="Must enter a valid last name" required="1" />
Everything EXCEPT apostrophes work fine. I've tested the regex on a builder site and all the characters are matching properly there, including the apostrophes. When the form submits, the apostrophe gets changed to its HTML character respresentation when the page refreshes. I'm thinking this is what's getting run through the validator and that's why it's not working. Do couch forms automatically change special characters?
Is there a decent workaround? I've thought about just manually doing a preg_match(), but it'd be nice to keep it simple and use the built in features.
Thanks