Page 1 of 1

Readonly Lookup field

Posted: Wed Jun 12, 2013 1:42 pm
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.

Re: Readonly Lookup field

Posted: Thu Jun 13, 2013 1:26 am
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

Re: Readonly Lookup field

Posted: Fri Jun 14, 2013 10:58 am
by ruiascensao
Cool!!!

Thank you.

BR
Rui

Re: Readonly Lookup field

Posted: Fri Jun 14, 2013 7:56 pm
by massiws
.