Welcome Guest, Not a member yet? Register   Sign In
Form Confusion, How to Properly Display Form Errors?
#1

[eluser]Chris.Campbell[/eluser]
Could someone please show me a code example of how to properly display form errors with CodeIgniter, yet keeping the already entered form data intact. I am able to accomplish this without the framework, using an error array, a foreach loop, counter, and having some post defaults. How would one go about this using CI? Thanks!
#2

[eluser]Michael Wales[/eluser]
Code:
<?= $this->validation->error_string; ?>

<?= form_open('user/login'); ?>
<input type="text" name="username" value="<?= $this->validation->username; ?>" />
<input type="submit" value="Go" />
<?= form_close(); ?>
#3

[eluser]Chris.Campbell[/eluser]
Ok first can you explain the $this->validation->error_string part more, and how I would go about populating that with data.

Also, I am using the template parser.
#4

[eluser]kgill[/eluser]
Read the user guide, specifically the notes for the validation class, if you're still confused ask again.

- K
#5

[eluser]jorre[/eluser]
I managed to do this just by using the code from the user guide, so try that out first.
#6

[eluser]Chris.Campbell[/eluser]
Oh wow, thanks guys, I did not even see a validation class in the user guide.




Theme © iAndrew 2016 - Forum software by © MyBB