little JQuery code in CF6

szabob 18 Jul, 2019
Hi all,

I use google maps with a search field. In CF5 I use a little code to prevent the form submitting itself when searching the map:
jQuery(document).on("keypress", ":input:not(textarea)", function(event) {
if (event.keyCode == 13) {
event.preventDefault();
}
});
This little code does not seem to work in CF6.

Any suggestions?

Regards

Bob
Max_admin 19 Jul, 2019
you used it in a JavaScript view ? if yes then what settings did you use ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
szabob 19 Jul, 2019
Hi Max,

yes it was in a Load JS action as part of the Google maps code. I was able to migrate the maps code into CF6 but this particular bit does not work.

Regards

Bob
Max_admin 19 Jul, 2019
Do you have the "Include in document ready" setting enabled ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
szabob 19 Jul, 2019
Max,

The whole code is put in a Custom Code Action between <script></script> tags. It may be a bit creative but good enough to make Google Maps work.
Max_admin 12 Aug, 2019
I'm not sure if you have fixed this or not, but adding events for the form elements should be inside a document ready event function, you can have a different action for the GMaps code!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.