How to enable CActiveForm element before save

HI,

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:





$("#Model_attribute").prop("disabled",true);




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?




$("#Model_attribute").prop("disabled",false);



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