![]() |
validation_errors() could not display error message? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: validation_errors() could not display error message? (/showthread.php?tid=36419) |
validation_errors() could not display error message? - El Forum - 11-30-2010 [eluser]Julia Yan[/eluser] --------------controller if ($this->form_validation->run() == FALSE){ echo "[removed]alert(' ".' input error please redo '."');history.go(-1);[removed]" ; /* if runing the above line, it back to page keep current input, but validation_errors() could not display error message? */ /* if do not runing the above line validation_errors() could display error message, but lost current input? */ } --------------view <?php echo validation_errors() ; ?> ...edit form --------------How can I get both ? 1, validation_errors() display 2, keep current input when page back validation_errors() could not display error message? - El Forum - 12-01-2010 [eluser]smilie[/eluser] Hi, Please use code tags for readability. To keep input values in your form do: In controller: Code: # Set all rules - ALSO on the input fields that are not required; In your view file: Code: $notes = array( Cheers, Smilie validation_errors() could not display error message? - El Forum - 12-01-2010 [eluser]Julia Yan[/eluser] Thanks smilie I did $this->form_validation->set_rules(...); //this validation_errors() could display error message, but lost current input? validation_errors() could not display error message? - El Forum - 12-01-2010 [eluser]smilie[/eluser] Please post your whole code here (and please, use code tags!). Cheers, Smilie |