How to have the controller change its behavior depending on the view?
Posted
by Ian Boyd
on Stack Overflow
See other posts from Stack Overflow
or by Ian Boyd
Published on 2010-03-17T18:24:49Z
Indexed on
2010/03/17
20:11 UTC
Read the original article
Hit count: 182
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?
© Stack Overflow or respective owner