How to enable CActiveForm element before save


I have a form with a dropdown and a text box. I am successfully updating the textbox via ajax callback when the dropdown is changed.

in the ajax script i can disable the textbox like this:


However, when a form element is disabled, it appears that it does not save to the database. What is the best way to re-enable a disabled form element prior to saving the form?

I know I can use the folllowing to re-enable the form, but where do I put this code?


I think this can be done in CActiveForm.clientOptions.beforeValidate(). Does anyone have an example?