Welcome Guest, Not a member yet? Register   Sign In
jump to error anchor on failed form validation
#1

[eluser]Unknown[/eluser]
I have posts page on which there is form with some fields.

On successful validation I redirect to same page and everything is great.
But when validation fails I can't redirect so I call the method that displays the post in the first place. Post is displayed with validation errors but the URL is set to "commentSubmit" method that I called.

For example:
post URL /display/post/post-name/
On success I go to same URL with redirect, but on fail I end up with:
/display/commentSubmit

Is it possible to somehow redirect and have validation errors saved so I can display them? Or some other way to get the URL to be /display/post/post-name/ again.

This is important for me because I display errors just over comment form which is way down on pages. So when error happens I don't see the error message unless I scroll down.
On successful pages I solved the problem with on page links(redirect to /display/post/post-name/#error). Or is there maybe some other way to jump to position where I display errors.

Thx.




Theme © iAndrew 2016 - Forum software by © MyBB