'warning' or 'notification' level input errors on forms

Hello,

I am currently implementing an extra feature to the model class.

I am fairly new to Yii, but thought that I'd share this thought and get some feedback.

Problem:

Sometimes, when submitting a form, users make minor errors that can be handled and do not require correction by the users refilling the form.

For example, you decide to restrict user names to lower case only and the user sends a mixed-case name during registration.

You are basically facing 3 main choices:

  • Send an error list back to the user and with original information.
  • Do the same, only this time you correct minor errors (the returned field value is the user's name in lower case).
  • Convert the value to lower case and store the data.

There are cases in which I would like to have the user notified that some of his submitted data was changed. using the example scenario, outputting a small message on the redirected page that says something like 'Your user name has been converted to lower case. Please use the name '{username}' to log in.

This example is a bit lame, as I definitely wouldn't do such thing with users' nick names, but I think that it shows the point.

Proposed solution:

Adding another level of errors that will be called 'warnings' or 'notifications'.

These 'notifications' should probably be raised by the validators.

The proper CModel methods should be added (addNotification, hasNotifications etc.).

The implementer should take into account that those notifications, if triggered, will not prevent data write.

It is probably possible to do something similar using 'onAfterValidate' with normal errors.

I am not yet sure of how to standardize the notification (as in many cases the user will be redirected after a successful submission):

Either have the CController::redirect() method do it somehow, or perhaps store the notifications in some application property and retrieve it from the view/layout when needed.

Sounds interesting to anyone? Any suggestions?

Don't hesitate to f/b.

Alon.

May be flash messages is what you are after? http://www.yiiframew…oc/cookbook/21/