Hi Forum
I have a formit form in the footer of a site, and currently when there is a validation error the page is just reloaded and the user is sent back to the top of the page. The error messages are displaying as they should but the problem is I want to send the user to the top of the form in the footer on an error instead. Is there anyway to specify which section (i.e. a div) the user is directed to on the error validation? How would I do this?
Thanks
Steve
I don’t think there’s a built in way to do this, I would try it with javascript (in my case jQuery). Looking for .error (or what ever class your validation errors have) and if there are some, scroll to the form with some plugin like scrollTo or so...
You can do it with anchors:
<form action="[[~[[*id]]]]#message" method="post" class="form">
<div id="message">
... Your message content here ...
</div>
... Your input fields here ...
</form>
Hope it helps!
[ed. note: Henrik Nielsen last edited this post 13 years, 10 months ago.]
- A small step for mankind, so why not take two...
Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
Thanks Henrik - that worked perfectly.
Nice! Learned something again =)