Welcome Guest, Not a member yet? Register   Sign In
Form Validation class/repopulating

Noob to CI, need help understand the Form Validation class, specifically when re-populating the form

Controller has logic:
$this->form_validation->set_rules('shortdesc','League Name','required|trim|min_length[1]|max_length[45]');

and this appears to work. Having done this, and following the example from the user guide I expect that

echo 'set_value::shortdesc='.set_value('shortdesc');

will display the submitted value in the shortdesc input field. It doesn't. When I echo the $_POST['shortdesc'] I can see the submitted value. I get the impression from the user guide that set_rules will create and store a member variable on the Form Validation class that corresponds to the input field.

I added the following immediately after the set_rules, it made no difference:

$fields['shortdesc'] = 'League Name';

Any guidance you can offer is much appreciated.

[eluser]Ben Edmunds[/eluser]
Call set_value like so


and I'm not sure if you have to but I've always called it after


Adding the run() does the trick. Cheers!

[eluser]Ben Edmunds[/eluser]

Theme © iAndrew 2016 - Forum software by © MyBB