Welcome to the nuBuilder forums!

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

Readonly Lookup field

Locked
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Readonly Lookup field

Unread post by ruiascensao »

Hello,

I need to have a lookup field readonly after data input in a subform using Javascript.
Could someone please help me on this?

Thank You.
BR
Rui
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Readonly Lookup field

Unread post by massiws »

Rui, in the form you can add a function like this in Custom Code > Javascript:

Code: Select all

function lockField(id) {
    if($("#code"+id).val()) {
        $("#code"+id).attr("disabled","disabled");
        $("#luup_"+id).remove();
    }
}
and, on each lookup field you want to lock, in Lookup tab > Javascript insert this:

Code: Select all

lockField("your_field_name");
This will lock the lookup code field and remove the magnifying glass; if you need to edit the field, you have to save and reload the record again.

Hope this helps,
Max
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Readonly Lookup field

Unread post by ruiascensao »

Cool!!!

Thank you.

BR
Rui
BR
Rui
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Readonly Lookup field

Unread post by massiws »

.
Locked