Welcome Guest, Not a member yet? Register   Sign In
SOLVED: Dynamically dropdown <select> form validation
#1

[eluser]atno[/eluser]
Hi,

I have a <select> that is created dynamically from a database and it must validate to check if any option is selected. The options are about 58 and only one can be selected. If a user selects something but forgot to enter his/her name on submit the select will be reset, he/she will type his/her name and now when submit is pressed again there will be a new error showing that no option is selected!
I read the user_guide but I don't get it how to form_validate a <select> with so many dynamically generated options. What I understand is that every set_select() but be entered manually.
Is there a way to do it and i have missed the big picture?

Here's the code

Code:
<select name="test" size="1">

          &lt;?php

             foreach ($tests->result() as $test) {

                echo "<option value=\"$test->id\">" . $test->name . '</option>'. "\n";

              }

            ?&gt;
</select>

Cheers,
atno


Messages In This Thread
SOLVED: Dynamically dropdown <select> form validation - by El Forum - 05-02-2011, 06:30 PM
SOLVED: Dynamically dropdown <select> form validation - by El Forum - 05-02-2011, 07:14 PM
SOLVED: Dynamically dropdown <select> form validation - by El Forum - 05-02-2011, 07:19 PM
SOLVED: Dynamically dropdown <select> form validation - by El Forum - 05-03-2011, 01:21 AM
SOLVED: Dynamically dropdown <select> form validation - by El Forum - 05-03-2011, 05:47 AM
SOLVED: Dynamically dropdown <select> form validation - by El Forum - 05-03-2011, 06:04 AM
SOLVED: Dynamically dropdown <select> form validation - by El Forum - 05-03-2011, 06:08 AM
SOLVED: Dynamically dropdown <select> form validation - by El Forum - 05-03-2011, 09:07 AM
SOLVED: Dynamically dropdown <select> form validation - by El Forum - 09-11-2012, 03:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB