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.
ruiascensao
Posts: 177 Joined: Tue Nov 15, 2011 2:24 pm
Unread post
by ruiascensao » Tue Sep 30, 2014 11:34 pm
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();
}
}
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:
Unread post
by massiws » Wed Oct 01, 2014 11:01 pm
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
Unread post
by ruiascensao » Fri Oct 03, 2014 3:42 pm
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:
Unread post
by massiws » Sat Oct 04, 2014 8:07 pm
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
massiws
Posts: 503 Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:
Unread post
by massiws » Sat Oct 18, 2014 12:41 pm
.