I’ve created a custom form, similar to a customer registration form, in Magento.
i want to prepopulate this form when an error messages arises.
Does anyone know how I can prepopulate a custom form in Magento?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Without seeing you code it is hard to say which method will method will work, but one of these method should work.
Using JavaScript Validation – client side validate, only post if all require info is correct
See a list of all the validation class name
Repopulate field
To get a list of all the post variable information that the customer fill out
To get a form field (eg.
<input type='text' name='firstname' ... />)So in you .phtml try (this will not work if you doing a redirect on error)
If the above doesnt work then you need the save the post info into a session.
In your controller if validation fail save the information to customer session
In your phtml template, print the data if ‘yourFormName’ variable session exist.