And the fields are not used in every actions. For example :
loginAction=>username & password
registerAction=>all fields except role
changepasswordAction=>password & repeat password
profileAction=>firstname & lastname & mail & notification & avatar
updateAction=>all fields execpt password & repeat password
retrievePassword=>username & mail
I tried to write a _form partial rendered in every actions by filtering the fiels with the following operators : isNewRecord, scenario, checkAccess. But the _form file is now full of operators and a mess.
Do you have any advice about the _partial strategy I need to use ?
I have the same problem. Of course you will use model scenarios to determine which fields are required when… but so far as reusing the view code without a zillion conditionals…
Could you use renderPartial in the view to bring in the additional parts of the view and use controller logic to determine which parts need to be included?
Thats not very satisfactory either. Maybe someone else has a better idea. Right now I’m just making copies of the view with slight tweaks. It would be nice if there was a way to generate a view for each scenario automatically.
Actually I think that cut the form in multiple views and add the fragments you want in the main view by using renderPartial is almost the same as making copies of the form.
So for now I think I will make copies of the form. It is not "dry" but I think it is still better than an unreadable view file !
If someone has a solution, let us know plz
PS : someone knows how I can prevent the password fields to be populated ?