This topic is locked

Dynamically set Edit field as 'read only'

10/18/2006 7:27:26 PM
ASPRunnerPro General questions
C
ChrisC author

Dear Support
Is it possible to set edit page fields dynamically to 'read only' in the event 'Edit Page: On Load' based on another field value/condition?
I think NOT possible and only by manually coding asp (which could be easier) as assume the code 'if GetEditFormat(sFieldName) <> EDIT_FORMAT_READONLY then' to create read only fields is hard coded and GetEditFormat(sFieldName) reads from file and not memory so can't be updated dynamically.
Any suggestions appreciated.
Thanks
Chris

Sergey Kornilov admin 10/24/2006

Chris,
OnLoad event won't work for this purpose because edit controls are not created yet when event occurs.
You can modify ..._edit.asp file adding the following code after edit controls created (at the end of file).

if rs("AnotherField")>0 then _

Response.Write "<script>document.editform.value_FieldName.disabled=true;</script>";