Forums

Javascript Jump to Anchor

wayne.regehr 16 Sep, 2014
1 Likes
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.
Max_admin 17 Sep, 2014
Thanks!🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 17 Sep, 2014
Hi Wayne,

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

Bob
This topic is locked and no more replies can be posted.