I’m looking for a concrete solution, ideally a git repo reference or other very specific code example, to implement form validation for US Phone and US Zip Code inputs on EE4 Registration Forms.
I’ve found some older references on these forums to Jquery Validator, which I like a lot and use for other projects. However, the dynamic nature of the [name] and [id] attributes that EE4 assigns to reg form inputs requires more finesse than this lib offers out of the box.
I thought it was weird that you couldn’t simply use the class that’s available (e.g. zip and phone). Looking closer it is possible though isn’t perhaps easily seen in the validation documentation.
I whipped up an example (and please note it is purely an example and will need to be refined) where it will validate the Zip and Phone for US styles using the jQuery Validation plugin:
Thanks Dean! This looks great. Given the unique system-question classes + your remote calls to validation js, I think your code could work as-is for testing.
For testing, I don’t see an issue calling it on every page. Where would you add it to be most unobstrusive? functions.php? theme-functions.php? header.php?
The support post ‘Registration Form Validation: Phone & Zip Code’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.