Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Save form data with redirect on validation failure
  • Hello!

    Many controllers in my app uses the Validation class to validate inputted form data, and when there is any failure, it redirects (back) to the form. However, all the form data is lost because the page is reloaded. Is there any good way to restore the form data without manually setting all the fields and values (which is a horrible thing to do, if possible at all)?

    Thanks in advance!
  • That dependents. 

    If you have a hardcoded forum, either in HTML or using the Html / Form classes, you need to pass the data back to the view, and hardcode the mapping between that data and form field values.

    If you use a fieldset, it has a populate() method that you can use to feed the validated results back into the fieldset, and a repopulate() method that uses the raw input to repopulate.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion