If from one view a user enters some invalid data, e.g.:
E-mail: [email protected]
then i want the controller to:
- not place the data into the model
- color the text box reddish
- not allow the user to save
But it's possible that if the user enters the same invalid data in a different view i want the controller to:
- place the data into the model
- color the text box reddish
- allow the user to save
But it's possible that if the user enters the same invalid data in a different view i want the controller to:
- place the data into the model
- color the text box bluish
- allow the user to save
And it's possible that another view will:
- place the data into the model
- leave the text box uncolored
- allow the user to save
And it's possible that another view will:
- auto-correct the data, placing it into the model
- color the text-box reddish
- allow the user to have
And it's possible for another view to:
- auto-correct the data, placing it into the model
- update the view with the new data
- color the text-box bluish
- allow the user to save
[ad infinitum]
Without using n-controllers for n-views, how do i do this?
Update
i was about to ask a new question on stackoverflow, 'How do i have the controller change its behavior depending on the view." But then i realized that i have the exact same question title in use already.
Today's example:
If the entered data is too long for some parts of some of the database tables it will be going into, then perform validation and reject a save.
unless the data is coming from another view. In which case automatically trim certain fields to fit the database rules
unless the data is coming from another view. In which case, require the database to throw it's
truncated
exception
So many practical problems with MVC that i never see addressed in the books/articles/blogs i've read - it's no wonder i don't use it.