if i replace “username” with “anotherfield” i get a “Property ‘User.anotherfield’ is not defined” error. If i create a “anotherfield” column in tbl_user there is no error. Does this mean that the DB is checked for each field existence of the form each time i use this widget ?
for the DB column "username" the form field id is "User_username" and the name is "User[username]". How can i change this without changing the DB column name ?
why would you want to change it. The name of the input will be always “modelName[fieldName]” and its id will always be “modelName_fieldName”. If you change it, then it won’t worked in your controller code where there are line like this
$model->attributes = $_POST['modelName'];
because you are putting other name. So you might need to manually write it down to like this
For 1) is it possible to avoid it or we should not do that ?
For 2) i dont like to name form fields the same as DB tables that’s why. Is there any way to map field names to tables names like the attributeLabels method does for form labels ? The attributeNames method does not seem to do that.