FAQ
Hi,

Does HTML::FormFu offer a way of using a constraint that disallows sending
invalid dates like February 30?

If it doesn't, do you have a recommendation for using another module that
can do this check?

Thanks.

Octavian

Search Discussions

  • Carl Franks at Feb 15, 2010 at 3:37 pm

    On 5 February 2010 16:02, Octavian Rasnita wrote:
    Hi,

    Does HTML::FormFu offer a way of using a constraint that disallows sending
    invalid dates like February 30?
    HTML::FormFu::Constraint::DateTime should work fine for this.

    Carl
  • Octavian Rasnita at Feb 15, 2010 at 5:07 pm
    From: "Carl Franks" <fireartist@gmail.com>
    On 5 February 2010 16:02, Octavian Rasnita wrote:
    Hi,

    Does HTML::FormFu offer a way of using a constraint that disallows
    sending
    invalid dates like February 30?
    HTML::FormFu::Constraint::DateTime should work fine for this.

    Carl

    Thank you! I don't know how I skipped it.

    Octavian
  • Octavian Rasnita at Feb 15, 2010 at 6:36 pm
    From: "Carl Franks" <fireartist@gmail.com>
    On 5 February 2010 16:02, Octavian Rasnita wrote:
    Hi,

    Does HTML::FormFu offer a way of using a constraint that disallows
    sending
    invalid dates like February 30?
    HTML::FormFu::Constraint::DateTime should work fine for this.

    Carl

    Hi,

    I think that Date and DateTime fields should use by default the DateTime
    constraint, or any other constraint that assures that the chosen date is
    valid.

    I have checked the DateTime constraint, (I want to use it with Date and
    DateTime fields) but it requires too much code.

    In the DateTime fields, I use something like:

    strftime %Y-%m-%d %H:%M:00

    but for using the DateTime constraint, I should define this format a second
    time for each field, and use strptime instead of strftime.

    I think the DateTime and Date fields should use by default the DateTime
    constraint because those fields should always send correct date values.

    I put the following in the myapp.pl Catalyst configuration file which sets
    this constraint for all the DateTime elements, but it would be nice if it
    wouldn't be necessary:

    'Controller::HTML::FormFu' => {
    constructor => {
    default_args => {
    elements => {
    DateTime => {
    constraints => [
    {
    type => 'DateTime',
    parser => {strptime => '%Y-%m-%d %H:%M:00'},
    },
    ],
    },
    },
    },
    },
    },

    Thanks.

    Octavian

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouphtml-formfu @
categoriesperl, catalyst
postedFeb 5, '10 at 9:02p
activeFeb 15, '10 at 6:36p
posts4
users2
websitemetacpan.org...

2 users in discussion

Octavian Rasnita: 3 posts Carl Franks: 1 post

People

Translate

site design / logo © 2022 Grokbase