Validating select box
This tutorial will show you how to add select boxes and multi-select boxes to a form, how to retrieve the input data from them, how to validate the data, and how to take different actions depending on the input.
Let’s look at a new input: a “select” box, also known as a “drop-down” or “pull-down” box. Each option has a “value”, just like other inputs, and also a string of text between the option tags.
In our example, we have created a select option field in form with fetched values from database using for each loop and set validation rules for fields.
watch our live demo or copy paste our codes as per directed in read me file.
If the menu is open, pressing the Tab key will close the menu only.
Java Script provides a way to validate form's data on the client's computer before sending it to the web server. First let us see how to do a basic form validation.Otherwise, it will function as a minimum width setting, and the size of the Select will still change when the user picks certain long options.the prompt will appear as a separator in the options list.Now we will see how we can validate our entered form data before submitting it to the web server.
The following example shows how to validate an entered email address.
download the selectoptionfield_file from below link, extract files and include them in view, controller and model directory of your codeigniter framework as shown in the Read file.