Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

lookup object

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

lookup object

Unread post 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?
BR
Rui
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: lookup object

Unread post 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
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: lookup object

Unread post 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.
BR
Rui
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: lookup object

Unread post 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
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: lookup object

Unread post by ruiascensao »

Hi Max,

Thanks ...it works fine!
BR
Rui
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: lookup object

Unread post by massiws »

.
Locked