php - set_value() not working without having a validation rule -


i have found when use set_value() in codeigniter 2 form, repopulate form field, returns value if have validation rule set input.

which fine if validating field, not fine if optional input no validation.

so plan standard every single form process, add little hack create 'empty' rules before adding genuine validation rules;

//iterate on every posted value , create empty rule it. foreach ($this->input->post() $key => $value) {     $this->form_validation->set_rules($key); } 

then if have 'real' rules add them afterwards overwrite previous empty rule.

what want know is, there way this, built framework? seems bit of omission these values not available set_value() function until have rule, makes me wonder if have missed configuration option?

instead of set_value, can use $this->input->post() submitted value.

for ex:

<input name='test_name' type='text' value = '<?php echo $this->input->post("test_name");?>' /> 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -