Hello,
The
getFieldByName method does not return the input of the field, but rather the containing <div> element of the field.
In order to prevent a user from editing a field, you will need to run code similar to the following sample to disable all of the inputs of the field.
// Disable all inputs of a date property.
var inputs = getFieldByName("test_date").getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++)
{
inputs.disabled = true;
}
// Disable all inputs of an Item property.
// I needed to wrap this code inside of a timeout to work around an issue where the field was not being disabled
setTimeout(function(){
// Disable the text field of the Item property
var inputs2 = document.getElementsByName("test_item")[0].getElementsByTagName("input");
for (var i = 0; i < inputs2.length; i++)
{
inputs2.disabled = true;
}
// Disable the ellipsis button that launches the search dialog
var button = document.getElementsByName("test_item")[0].getElementsByTagName("button")[0].disabled = true;
}, 0);
This sample was written to be run from an onFormPopulated Form Event.
Chris
_______________________
Christopher Gillis
Aras Labs Software Engineer