Welcome Guest, Not a member yet? Register   Sign In
How do I show form fields after validation fails?
#1

[eluser]The Mask[/eluser]
Hi,
I am using the validation class on certain fields which is working fine.
However, on the fields that require no validation (e.g. Forename), how do I show the entered value on the form if the validation fails on other fields?
Thanks
Neil
#2

[eluser]Crimp[/eluser]
See the CI user guide for the Validation class. You put this in your HTML value: $this->validation->[name of field];
#3

[eluser]webthink[/eluser]
Crimp I think you may have misread the question. The OP needs to know how to repopulate fields with *no* validation.
The simple answer is to put it in your fields and validation array without actually attaching any rules to it.

In our apps we tend to have a $defaults array that gets populated any number of ways.
1. from scratch - no validation has occurred the form is just empty... $defaults gets populated with '' or 0 depending on the type of field
2. from db - this is for initial display of forms meant to update a record... $defaults gets populated with fields from the db.
3. from post - after failed validation $defaults gets populated with fields from the post.
#4

[eluser]The Mask[/eluser]
Thanks for the replies.
It crossed my mind that I may have to set up dummy rules and then populate from $_POST but thought there may have been an easier way.
Many thanks




Theme © iAndrew 2016 - Forum software by © MyBB