Buy Now
Sign in

Javascript Jump to Anchor

wayne.regehr , September 16 2014
Featured
W
wayne.regehr
I recently created an events form that required an extra validation to check for the ticket quantity available vs the ticket quantity requested. This events form sits on a longer page which gave me the issue of how to make sure that the user sees any errors or messages, etc.

The solution was to jump to an anchor in the page using javascript.

I did read some other similar posts, however the solution mentioned was not working for me. In case this can be useful for someone else I've decided to share.

window.onload = function() {
var form = document.getElementById("ANCHOR_ID");
form.scrollIntoView();
}


Simply replace "ANCHOR_ID" with the correct ID in your page/form.
admin
Thanks!
Max
If your main question got answered then please mark the answer using the button!​

Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
GreyHead
Hi Wayne,

Please see this FAQ which has some similar examples for CFv4.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much