Is this form required to enter data that is not permanently stored in dataabse? If so, you should create a new model derived from CFormModel, not ActiveRecord. Your siteโs controller can handle the launch of CFormModel views, which then take care of themselves (validation, ajax, whatever) if they donโt need dynamic interaction with the server (LoginForm), or they can have a separate controller if more complex interaction is necessary (RegisterForm) . In CFormModel, you can access user input during a session and process / save it as you like, but then it disappears when the user is done. See LoginForm and RegisterForm for a demonstration of the blog, for example, templates. Does this form have dynamic data interaction with other models, as well as with the user (and not just a one-time cascade interaction)? In this case, it is best to create a separate separate registrar that you specify. This is what the demo of the blog does, and it is a fairly simple application. You can use gii to automatically create a CRUD interface for administrators and moderators / community managers from your User model. You can then configure it and renderPartial when you want to reuse one of these views for a non-admin user. Validation rules in models carry over too. Only guests and usually privileged users need the disabled LoginForm and RegisterForm interface.
source share