Josh also teaches full-stack web development at the UCI Coding Bootcamp.
When Josh isn’t building websites, he’s building websites.
An email address has some text, followed by the @ symbol, then a domain name, a dot (.) and finally an extension. An age-old question is “where do we check for valid input: server-side or client-side?
” Server-side checking entails the user submitting the form to the server, such as ASP, C# or PHP, then the server code checks and returns an error if it finds one. Client-side validation usually means: Java Script intercepting the form before it’s submitted to check for errors, possibly using regex.
The idea is to create a set of “validation descriptors” associated with each element in a form.
For ‘selections’ like drop down and radio group, use an appropriate validation like ‘dontselect’ or ‘selone_radio’.
When the form is submitted - either by hitting Enter or clicking on the Submit button - the to abort (cancel) the form submission. In a real-life situation you will most likely have more fields to check, and more complicated conditions, but the principle remains the same.
All you need to do is extend the command, in which case the form will be submitted.
As web developers, we want to protect the information filled out in form fields.
Bad information leads to bad user interactions, bad analytics and bad sales. Email addresses should always have the same structure: [email protected] . An email form field should check if the user has entered an email address correctly.