Im using codeigniter validation class when submit forms. Also Im using set_value() to re-populate fields on form fails. If I have
$this->form_validation->set_rules('name', 'Name', 'required')
set_value() works and field is re-populated. But what if I dont wont the field to be required ? If I do not add $this->form_validation* re-populating is not working
The website-lab’s post is correct – it’s a feature of CI that no
set_value($foo)are returned unless there is a validation rule.If you don’t want to have empty validation rules, there are a few hacks available and you can extend the form helper
this thread has a lot of information –
http://codeigniter.com/forums/viewthread/96617/P15/#689642
I also believe you can just use
$this->input->post('my_field')in your view, if using empty validations or hacking the core doesn’t appeal to you.