[html-formfu] some questions
mario.minati at googlemail.com
Fri Sep 7 18:40:10 GMT 2007
On Friday 07 September 2007 17:10:11 Jim Spath wrote:
> I'm new to HTML::FormFu (never used HTML::Widget) either, and have a
> couple of questions:
> The first one is how to easily utilize values which have been altered by
> FormFu's validation. An example would be the TrimEdges filter. If a
> user enters a value like " foo " and we need to redisplay the form, I
> would like the prefilled value to be "foo".
The usual behaviour is to give the data back to the user exactly the way he
wrote it, returning preprocessed values may confuse him.
That's also the default behaviour of FormFu.
I'm not sure if that can be changed. Maybe anyone else can help out.
> Secondly, if I want to add a complex validation routine, like checking
> to see if a US address is USPS deliverable, is this best done as a
> callback constraint, or a validator? If validator, can someone point me
> to an example of a validator? The only useful information on validators
> seemed to be t/validator.t
Best place would be a validator, regarding to the docs:
Also from my practice, validator is the right state during the form
I think the best way to create your own validator is to look in the source
code in svn. There is jet no howto or other examples out here, but it's quite
easy (tm). Just have a look in the source of the callback-validator.
More information about the HTML-FormFu