Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Onclick event on a lookup field

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
PoppingMonks
Posts: 3
Joined: Tue Dec 21, 2021 4:50 pm
Has thanked: 1 time

Onclick event on a lookup field

Unread post 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!
kev1n
nuBuilder Team
Posts: 4562
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:

Re: Onclick event on a lookup field

Unread post 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');
});

kev1n
nuBuilder Team
Posts: 4562
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:

Re: Onclick event on a lookup field

Unread post 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)
PoppingMonks
Posts: 3
Joined: Tue Dec 21, 2021 4:50 pm
Has thanked: 1 time

Re: Onclick event on a lookup field

Unread post by PoppingMonks »

Many Thanks Kevin
Post Reply