Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Lookup On Change

Locked
Eggsalad
Posts: 12
Joined: Sat May 04, 2013 1:17 am

Lookup On Change

Unread post by Eggsalad »

Hi-

Very happy starting to use nuBuilder. Just a couple of strange things to address.

I'm trying to add Javascript to the On Change event of a Lookup Object, but it never seems to trigger.

When I look at the page source, I see the following:

* The value property of the foreign key field (which is hidden on the page) changes as expected when I select a different lookup record, but the foreign key field doesn't include the on change event call.

* The lookup code field includes the on change event call, but its value property doesn't change, even though its displayed value changes.

Any ideas?

Thanks!!
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Lookup On Change

Unread post by admin »

EggSalad,

Are you putting the onchange on the Code field or the hidden ID Field?

Steven
Eggsalad
Posts: 12
Joined: Sat May 04, 2013 1:17 am

Re: Lookup On Change

Unread post by Eggsalad »

I'm putting it in the Onchange box in the All tab of the Lookup object. The Lookup object's field name is the ID field because that's the foreign key in the table.

I didn't see a place to specify where the onchange actually ends up in the markup. It seems to go in the code field.

Thanks!
Eggsalad
Posts: 12
Joined: Sat May 04, 2013 1:17 am

Re: Lookup On Change

Unread post by Eggsalad »

Maybe I should put the js function call in the Javascript box on the Lookup tab instead? The wiki says that code is "launched after the Lookup Object is populated". I wonder if that's the same as onchange, if it would launch after selecting the same row in the lookup which is already there (e.g. code is "XYZ" when edit form loads, click magnifying glass, select row with "XYZ" code, edit form doesn't change).
Eggsalad
Posts: 12
Joined: Sat May 04, 2013 1:17 am

Re: Lookup On Change

Unread post by Eggsalad »

Ok, it seems to be working as intended by putting the code in the Javascript box on the Lookup tab of the Object.

I can see though that this isn't equivalent to onchange, which still seemed to behave strangely, and I'm not actually sure where this code now gets called. But I guess I'll cross that bridge when I need to.

As I said before, nice work with nuBuilder! So happy not to have to code this project from scratch.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Lookup On Change

Unread post by admin »

.
Locked