How to run custom JavaScript function during onchange event

razlie 20 Nov, 2017
Hi I want to run a custom function during onchange event in my input text field..
My question is how do i specify / set the function to run in the onchange event ..

Appreciate your help
Max_admin 23 Feb, 2018
Hi Razlie,

Just add the function name in the "Element identifier" box and define teh function in a JavaScript element

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Joao Serina 23 Feb, 2018
Hi Max,

I must be doing something wrong because I have tried to do this and it didn't work. I tried the function name with and without brackets "()" and neither worked.

My JS code is in a custom JS code in the designer tab but I have also tried it with the script on a custom code action in the setup tab.


Thank you for your time.

Best regards,
Joao Serina
Max_admin 03 Mar, 2018
Answer
Hi Joao,

The function name should be in the "Element identifier" box without brackets and the function should be defined in a JavaScript element:
function xyz(){
alert(123);
}
This does not work ?

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Joao Serina 13 Mar, 2018
1 Likes
Sorry for the late reply,

I didn't test it yet but I was calling a function that was encapsulated in a jQuery call like:
(function($)
{
$(document).ready(function () {

});

function MyFunction()
{
alert("test");
}

})(jQuery);
So this was probably the problem.

Thank you very much for you quick reply and once again I appologuise for the delayed reply.
Max_admin 14 Mar, 2018
Hi Joao,

No problems!🙂

Best regards
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.