Page 1 of 1
Detect lookup onchange
Posted: Tue May 21, 2024 2:19 pm
by Giu
Hi, based on the selection done on a lookup, I have to retrieve data from database related to the lookup selection, show it on screen, and use it on my form save. I guess I can use the Display object, but the query depends on the selection of the lookup and starts empty and can change and display must be refreshed.
There are some nuWay to do this? or just capture with javascript the lookup onchange, and fire a procedure with nuRunHiddenPhp+nuAddJavascript combo?
Re: Detect lookup onchange
Posted: Tue May 21, 2024 2:59 pm
by kev1n
If the data is part of the lookup form, you can use
nuSetFormValue().
Alternatively, you can use a Display object. After the lookup value is changed, call
nuRefreshDisplayObject() to update the Display object accordingly.
Re: Detect lookup onchange
Posted: Tue May 21, 2024 3:11 pm
by Giu
Interesting, but is not shown in the lookup browse if this detail is important.
Alternatively, you can use a Display object. After the lookup value is changed, call
nuRefreshDisplayObject() to update the Display object accordingly.
Yes, I noticed about this JS function 2 minutes ago, but is not working at all to me.
I have this SQL on my 'prm_negras' display object
Code: Select all
SELECT
fichas_prm.prm
FROM
fichas_prm
WHERE
((fichas_prm.usuario = '#oponente#'))
and my 'oponente' lookup object CC looks like this
uOrZ2lTVIZ.png
No errors in web console at all. I'm doing correctly?
Re: Detect lookup onchange
Posted: Tue May 21, 2024 4:47 pm
by kev1n
Add the JS code in the LUJS (Lookup JS) event of the lookup object.
Re: Detect lookup onchange
Posted: Tue May 21, 2024 9:07 pm
by Giu
Perfect!! Thanks.
(I just discovered the thanks and Accept answer buttons

)