[html-formfu] How do I constrain a field that's not required?

Barry Hoggard bhoggard at gmail.com
Sat Sep 1 22:43:05 GMT 2007


On 9/1/07, Carl Franks <fireartist at gmail.com> wrote:
> On 01/09/07, Barry Hoggard <bhoggard at gmail.com> wrote:
> > I have a form with an optional URL field.  How do I constrain that to
> > be a valid URL, but only if the user enters something?  I don't want
> > it to be required.
>
> All constraints should pass if the value is missing or the empty
> string - if it doesn't, it's a bug.

I see what's going on.  I thought it had suddenly become required
because adding the contsraint causes it to be marked as required when
I use

auto_constraint_class: required

at the top of my yml rather than

auto_constraint_class: %t

I hadn't understood how that part worked.  Thank you.

-- 
Barry Hoggard



More information about the HTML-FormFu mailing list