Page 1 of 1

Onclick event on a lookup field

Posted: Wed Jan 12, 2022 1:15 am
by PoppingMonks
Hi,

I am finding that when I add an onclick javascript event to a lookup object, the click event is tied to the label and not the magnifier image. Any suggestions for a workaround?

Thanks!

Re: Onclick event on a lookup field

Posted: Wed Jan 12, 2022 8:15 am
by kev1n
Hi,

The workaround is to add a click handler in the form's Custom Code:

E.g. if your lookup's Id was emp_name, the button's Id is emp_namebutton

Code: Select all

$("#emp_namebutton").click(function(){ 
  console.log('your code here');
});


Re: Onclick event on a lookup field

Posted: Wed Jan 12, 2022 10:13 am
by kev1n
Update: This is now fixed on Github.

The onclick event is triggered when the lookup's search button is clicked. All other events (oninput, onchange etc.) are fired for the input (lookup code)

Re: Onclick event on a lookup field

Posted: Wed Jan 12, 2022 4:51 pm
by PoppingMonks
Many Thanks Kevin