After form submit, add an anchor to the url, depending on error/success
This is an open discussion with 2 replies, filed under XSLT.
Search
If you're reloading the page I presume you'll be using XSLT.
You can always check if the event has been submitted you add some inline javascript.
<script>document.getElementById("comment-<xsl:value-of select='$commentID'/>").scrollIntoView()</script>
Or alternatively
window.location.hash = '#your-page-element';
both techniques should work if you're willing to put in a little bit of javascript since you would only know the anchor on load.
Thanks gunglien,
I am ok using javascript in this case – I have to anyway as I am using isotope for my layout and I need to jump to the anchor via javascript anyway after the page is loaded and layouted by isotope.
Create an account or sign in to comment.
Good evening,
I have created a blog. When someone adds a comment, I want the page to jump to an anchor - in case of success to the newly added entry - in case of an error to the form again
My idea is to add an anchor to the url (url#anchorname). I can add an anchor with
but in this case I can't because I only now which anchor after sending the form.
Is there a way to add the anchor while processing the page/form?
Thanks!