It is a good goal.  Again though, there are no standard features of 
mason that do this.

You could do field highlighting by:

1) When you process the form, any errors get stuffed into another key 
(hashref) in the session (ie: form_errors).  If any errors are found 
redirect back to the form.

2) Get the form errors out of the session and then when generating the 
form, you can do something like:

  <tr<% exists $form_errors->{FIELD} ? ' class="error"' : '' %>>
     ....
  </tr>

3)  Then create a CSS class for errors and have it highlight however you 
want.

  .error { background: #fff; }
  .error input { border: 1px solid #d00; }

There are lots of ways to do it.   This is a very basic / simple way.

Hope that helps,
Bradley C Bailey


Anthony Ettinger wrote:
> I'm trying to kill two birds with one stone here:
>
> Convenient messaging for notes, errors, and successes.
>
> ...when errors are found, also highlight the appropriate form fields
> (when applicable).
>
>
>
> On Dec 4, 2007 3:54 PM, Bradley C Bailey <[EMAIL PROTECTED]> wrote:
>   
>> There are no standard features in mason for this.
>>
>> If you are using sessions it is a fairly simple thing to implement.
>> Whenever you want to store a message, update your session.  You can
>> store a hashref with keys for errors, success, warnings, etc... to
>> differentiate different message types.  Then write a component that
>> displays them.   My display component whacks the data out of the session
>> once it is done.   You can put this comp in your autohandler so you
>> don't forget to display them.
>>
>> I have subclassed CGI::Session in the past to add a cleaner interface to
>> doing this and it worked out well.
>>
>> Hope that helps,
>> Bradley C Bailey
>>
>> Anthony Ettinger wrote:
>>     
>>> Are there any standard features in mason for messaging in the UI?
>>>
>>> ie: errors, successes, and generic messages.

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to