I am developing application using fuelphp. After validating the form field in server side I can shoe the error messages using Session::set_flash('error', $val->error()); . I can show the error messages on top of my forms.
I have got 20 fields in form I want to display error messages right below the fields. How do i do it ? How do i get the error message by passing the field name ?
If you use a fieldset, you can configure this, and it will happen automatically. You also don't have to create validations manually.
If you handcoded your HTML, you need to access errors individually. $val->error() returns an associative array with the name of the input field as key.
Note that validation objects are quite large, so if you want to store them in the session, perhaps you should convert it to a normal array first: