Custom Error Messages - CGI::Applicaiton::Plugin::ValidateRM

View: New views
2 Messages — Rating Filter:   Alert me  

Custom Error Messages - CGI::Applicaiton::Plugin::ValidateRM

by Adam-44 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a <textarea> field to evaluate and peg errors line by line.  So
if line 2 and line 5 are invalid, I want to note that as two different
errors.


Can I do this with CGI::Application::Plugin::ValidateRM?


I use an anonymous subroutine as the constraint for the textarea input
so I think that would be the right place to do that.  I see that you get
a Data::FormValidator::Results object passed to the anonymous subroutne
via the constraint, but can I insert multiple error messages with that?


Thanks,
Adam


#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: Custom Error Messages - CGI::Applicaiton::Plugin::ValidateRM

by Bugzilla from mark@summersault.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 03 Aug 2009 14:54:10 -0700
adam@... wrote:

> I have a <textarea> field to evaluate and peg errors line by line.  So
> if line 2 and line 5 are invalid, I want to note that as two different
> errors.

It is normal for fields to have more than one constraint, with the possiblity
that more than one of them can fail at a time. Usually this is still considered one
constraint with one name, but the error messages get appended together.

If you want separate tokens for each error message, then that's another story.
You could use a field_filter to split the text area into multiple fields before it gets
processed by the constraint_methods, and then define unique constraints for each line.

    Mark

--
http://mark.stosberg.com/




#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################