Here is a simple yet pretty powerful and easy to use way to do validation on HTML form text boxes and text areas and similar controls. It checks to make sure required form field have *something* in them before allowing processing to continue. It’s a good simple way to add some basic validation to prevent trusted individuals from forgetting to fill out required fields. This is generally useful for internal websites where you can assume the user isn’t trying to hack the site. First we have two global JS variables that define the default and error-ed state of text boxes in question. Below I have standard controls with black borders and error-ed controls with red borders. // Assign a default border color for all form controls var defaultControlBorderColor = '#000000'; // Use a special color to highlight trouble (such as if a control doesn't validate) var notificationControlBorderColor = '#ff0000'; Below I have the primary function that does the field validation. F...
Computers, programming, software development, AI, design, and more!