Welcome Guest, Not a member yet? Register   Sign In
set_select() makes all options selected, ignores third parameter
#3

[eluser]Vince Stross[/eluser]
Correction: After playing with this, I have to report that the set_select() function is working properly for me. The issue (now resolved but not comfortable with) is that the form fields have to be defined whether they have rules or not. I was assuming that the set_value(), set_select(), etc. functions were doing this for me.

In other words:
Code:
$config=array(
    array('field'=>'display','label'=>'Display','rules'=>'trim|required|max_length[50]'),
    array('field'=>'content','label'=>'Content','rules'=>''),
);
$this->form_validation->set_rules($config);

I would much rather have this be something like:

Code:
$config=array(
  array('field'=>'display','label'=>'Display','rules'=>'trim|required|max_length[50]'),
  array('field'=>'content','label'=>'Content'),

     - or (at the VERY least) -

  array('field'=>'content','label'=>'Content','rules'=>false),
);
$this->form_validation->set_rules($config);

Something doesn't feel right about having to define the rule as '' when it would be cleaner to just omit it all-together and check in the CI code using isset().


Messages In This Thread
set_select() makes all options selected, ignores third parameter - by El Forum - 10-24-2008, 01:07 PM



Theme © iAndrew 2016 - Forum software by © MyBB