I have controller users.
In this controller I have action account which is doesn’t do anything – it just has a view with multiple forms – change password, change something, block account etc. Each of this form links to some action: users/changepassword, users/changesomething etc.
These actions don’t have any views, just some logic and validation during save(..) and at the end simple redirect->( array( 'action' => 'account' ) );. So to sum up – in users/account view there are several forms pointing to separate actions. These actions after logic execution redirect back to users/account.
Now The problem is that I want to see all invalid fields in any form that was submitted (according to validation rules) – this works if view is in the same action as controller but when I use redirect all invalid fields are lost – how I can workaround it?
Two options:
1) Save the errors in the session, redirect back to accounts and set them there again.
2) And the better solution: Post all the forms to your account action and have a hidden field in each form containing the type or something. Based on the type call a model method that should do all the validation and save work if you followed MVC properly.