var prj = getFieldByName("project");
var test = getFieldByName("z_test");
prj.getElementsByTagName("input")[0].disabled = true;
prj.getElementsByTagName("button")[0].disabled = true;
test.getElementsByTagName("input")[0].value = "Done";
This event though, has no effect on the project drop down. It is enabled.
If I change the event to onLoad and load the item in a locked status then the field is disabled.
If I load the item unlocked and then lock it, the field is enabled.
What am I missing?
var prj = getFieldByName("project");
var test = getFieldByName("z_test");
prj.getElementsByTagName("input")[0].disabled = true;
prj.getElementsByTagName("button")[0].disabled = true;
test.getElementsByTagName("input")[0].value = prj.getElementsByTagName("input")[0].value;
Observations
onLoad
1. Loading item unlocked - All fields locked. z_test textbox blank.
2. Switching loaded item to Lock - All fields are enabled and z_test textbox is blank
3. Loading item locked - All fields are enabled and z_test textbox is blank
4. Toggling Lock status - All fields are enabled and z_test textbox is blank
onFormPopulated
1. Loading item unlocked - All fields locked. z_test textbox blank.
2. Switching loaded item to Lock - All fields are enabled and z_test textbox is filled with project value
3. Loading item locked - Project field is locked. z_test textbox is blank.
4. Toggling Lock status - All fields are enabled and z_test textbox is is filled with project value
var prj = getFieldByName("project");
var test = getFieldByName("z_test");
setTimeout(function(){
prj.getElementsByTagName("input")[0].disabled = true;
prj.getElementsByTagName("button")[0].disabled = true;
test.getElementsByTagName("input")[0].value = prj.getElementsByTagName("input")[0].value;
}, 100); // <-- this well be called after 100 milliseconds
If this doesn't resolve the issue you are seeing, you may need to increase the amount of time you are passing into the function.
Chris