There have been a number of times where I have had clients request that when certain fields are set one way or another they would actually like to disable the entire form. Or they want to disable the entire form except for a status field, or something like that. For some clients this was a HUGE pain in the neck because every field would have to be done manually. And whenever a new field was added if the script wasn't updated then that new field would be updateable while everything else would stay locked down.
Well, I found this code posted by Michael Höhne from Stunnware and it was exactly what I've been trying to do.
for (var index in crmForm.all) {
var control = crmForm.all[index];
if (control.req && (control.Disabled != null)) {
control.Disabled = true;
}
}
That will disable them all. Pretty sweet. Then if they want to leave a status field or something enabled just manually enable them afterwards:
crmForm.all.new_status.Disabled = true;
And you're all set.
David Fronk
Dynamic Methods Inc.
4 comments:
Slight correction, to enable one field manually, you need to set the property Disabled to false, not true.
crmForm.all.new_status.Disabled = false;
Saritha,
You are correct, thanks for catching that. I have since updated my post to read correctly.
Thanks again,
David Fronk
Dynamic Methods Inc.
Hi David,
It gave me a big help.
Thank in Advance,
Upul
Ping back from http://crmentropy.blogspot.com/2009/12/fire-event-on-any-crm-field-change.html
Post a Comment