Best approach for change table structure and form field auto update

  1. Change table structure

If the structure of one or more table(s) need to be updated, do I just manually add/delete those changes inside the MVC files?

  1. Form field auto update

If I want to create/edit a record, I key in the value in field A, I want field B display the appropriate value that based on what’s in field A. Do I use javascript (modify the _form.php and model file?) to handle this?

By the way, I’m the “CActiveForm”.


Answering your first question, when there are changes on table structure,

I usually change it at model file. But because I usually because I want this field in my form and I want to show it too, I update my view files too (especially _form.php, _search.php, sometimes view.php, _view.php and admin.php)

about the second question, if you can predict what is the change at the creation of the page, use javascript.

Usually for hide some field if some checkbox are unchecked.

If you cannot, use ajax, for example for popolate a dropdown in base of the choice of the first dropdown.

Thanks for the input.