James.Q.L wrote:

> i have looked at smolder dfv error message handling before. i don't like to 
> put the error messages
> in template. felt like hardcoded it too. esp when you have to do bunch of [% 
> if err_a_filed %] ..
> [% ELSIF missing_a_filed %] ... 

I don't see it as hard coding so much as giving the HTML/Design people the
ability to make the decision about what the message should be. But you get some
of the same benefits from using config files too.

> but it does give you the real flexiablity of setting up customized message.
> 
> one question though, if a field (say username) required at least lenght of 6 
> and contain only
> number and alphabet. how do you show different error based on user input for 
> this single filed?

I do this in the custom messages sub. If you provide multiple constraints for
the same field you can give each one a name. Then when you call invalid() on the
D::FV::Results object passing in the name of the invalid field you get an array
ref containing the names of the validation constraints that failed. Smolder does
this and then uses it to set the error flags.

-- 
Michael Peters
Developer
Plus Three, LP


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to