Page 1 of 1

lookup object

Posted: Tue Sep 30, 2014 11:34 pm
by ruiascensao
Hi,

How can I make a lookup object readonly?

I have tried:

Code: Select all

function lockField(id) {
    if($("#code"+id).val()) {
        $("#code"+id).attr("disabled","disabled");
        $("#luup_"+id).remove();
    }
}

Code: Select all

lockField("your_field_name");
But does not work. How can I use JavaScript to change attributes of this object? Readonly? Focus?

Re: lookup object

Posted: Wed Oct 01, 2014 11:01 pm
by massiws
Rui,
this is a jQuery issue: to retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method.
Instead of:

Code: Select all

$("#code"+id).attr("disabled","disabled");
try this:

Code: Select all

$("#code"+id).prop("disabled", true).addClass("nuReadOnly");
Hope this helps,
Max

Re: lookup object

Posted: Fri Oct 03, 2014 3:42 pm
by ruiascensao
Hi Max,

I tried but does not work for me.

Code: Select all

function nuLoadEdit() { 
  var data = $('#prea_status').val();     
  if(data == "CLOSED"){ 
        $('#prea_reference').prop("disabled", true);
        $('#prea_status').prop("disabled", true);
        lockField("#prea_goodinid");
        lockField("#prea_codecli");
    }
}

function lockField(id) {
    if($("#code"+id).val()) {
       $("#code"+id).prop("disabled", true).addClass("nuReadOnly");
       $("#luup_"+id).remove();
    }
}
Could you please advise?

Thank you for your replay.

Re: lookup object

Posted: Sat Oct 04, 2014 8:07 pm
by massiws
Rui,
you should inspect DOM elements to check elements name: "#luup_something" seems to be a nuBuilder 2 ID name!
To find lookup objects in nuBuilderPro you must use:
  • "code" + field-name: code field;
  • "btn_" + field-name: open lookup table button;
  • "description" + field-name: description field
Max

Re: lookup object

Posted: Fri Oct 17, 2014 1:02 pm
by ruiascensao
Hi Max,

Thanks ...it works fine!

Re: lookup object

Posted: Sat Oct 18, 2014 12:41 pm
by massiws
.