Welcome Guest, Not a member yet? Register   Sign In
Using the validation class with itihe form helper
#1

[eluser]phester[/eluser]
Hello All,
I am trying to figure out how to use the validation class to repopulate a select menu generated with the form helper.

Using the validation class with the form class for most input fields is simple:
Code:
form_input(array('name' => 'email', 'value' => $this->validation->email));

However, it's not so simple for a select menu.

This is what the user guide for the validation class has for pre-setting the select menu:
Code:
//From the validation class
<select name="myselect">
<option value="one" &lt;?= $this->validation->set_select('myselect', 'one'); ?&gt; >One</option>
<option value="two" &lt;?= $this->validation->set_select('myselect', 'two'); ?&gt; >Three</option>
<option value="three" &lt;?= $this->validation->set_select('myselect', 'three'); ?&gt; >Three</option>
</select>

And here is what the user guide for the form helper has for pre-setting the select menu:
Code:
//From the form helper
$options = array(
                  'small'  => 'Small Shirt',
                  'med'    => 'Medium Shirt',
                  'large'   => 'Large Shirt',
                  'xlarge' => 'Extra Large Shirt',
                );

echo form_dropdown('shirts', $options, 'large');  //This would select "large"

I will need to know which "value" to select to pass it to the form helper. Any ideas on how to work around that? I hope I described this situation clearly. Any help is greatly appreciated;


Messages In This Thread
Using the validation class with itihe form helper - by El Forum - 10-13-2007, 12:12 AM
Using the validation class with itihe form helper - by El Forum - 10-13-2007, 12:41 AM
Using the validation class with itihe form helper - by El Forum - 10-13-2007, 01:32 AM
Using the validation class with itihe form helper - by El Forum - 10-13-2007, 01:47 AM
Using the validation class with itihe form helper - by El Forum - 10-13-2007, 05:22 AM
Using the validation class with itihe form helper - by El Forum - 10-13-2007, 09:58 AM
Using the validation class with itihe form helper - by El Forum - 10-13-2007, 08:06 PM
Using the validation class with itihe form helper - by El Forum - 10-14-2007, 04:06 AM
Using the validation class with itihe form helper - by El Forum - 04-20-2008, 12:55 PM
Using the validation class with itihe form helper - by El Forum - 04-22-2008, 07:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB