FAQ
Hi,

Been using html::formfu for abit. Love the validation and configurability
behind it:)

got a very interesting question: How to override standard message, 'This
field is required'?

This is the message the comes up when you hit "submit" with an incomplete
form.
Those fields that are required which are left blank will have this message,
'This field is required' displayed.


Gordon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090325/18e3d786/attachment.htm

Search Discussions

  • Moritz Onken at Mar 25, 2009 at 11:34 am
    Hi,

    you can set "message" on every constraint which will overwrite the
    error message.

    Example:

    - type: Text
    name: foo
    constraints:
    - type: Required
    message: Dieses Feld wird ben?tigt


    See http://search.cpan.org/~cfranks/HTML-FormFu-0.03007/lib/HTML/FormFu/Constraint.pm
    for more information on that topic.

    cheers,

    moritz



    Am 25.03.2009 um 12:08 schrieb Gordon Yeong:
    Hi,

    Been using html::formfu for abit. Love the validation and
    configurability behind it:)

    got a very interesting question: How to override standard message,
    'This field is required'?

    This is the message the comes up when you hit "submit" with an
    incomplete form.
    Those fields that are required which are left blank will have this
    message, 'This field is required' displayed.


    Gordon
    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
  • Carl Franks at Mar 26, 2009 at 8:52 am

    2009/3/25 Gordon Yeong <anexiole@gmail.com>:
    Hi,

    ?? Been using html::formfu for abit. Love the validation and configurability
    behind it:)

    got a very interesting question: How to override standard message, 'This
    field is required'?

    This is the message the comes up when you hit "submit" with an incomplete
    form.
    Those fields that are required which are left blank will have this message,
    'This field is required' displayed.
    You can also create your own I18N class to override the default
    messages, so you don't need to put them in your form config.

    The Localize stuff doesn't seem to be very well tested, though - and I
    can't find a way to set it up from a config file, other than
    'localize_class', which will mean you have to define *all* messages in
    your own class, as you'll lose the default FormFu messages.

    I'm not sure why add_localize_object() adds the object to the end of
    an array - this means you can't override default FormFu messages, you
    can only supplement them.
    I'd suggest we change this, to add it to the start of the array.

    I'd also suggest we add a add_localize_class(), so it can be called
    from a config file, such as:
    add_localize_class: 'MyApp::I18N'

    Has anyone been using the I18N methods, and want to chip in?

    I'm also not sure why add_localize_object() expects an object for a
    specific language, where_as 'localize_class' correctly expects the
    base-class, and sets it up with $form->languages()
    Barely any of this is currently tested, so I'd be quite happy to break
    that if it would improve its usability.

    Carl
  • Daisuke Maki at Mar 26, 2009 at 9:35 am
    May I suggest <plug>Data::Localize</plug>?

    I wrote it specifically cause debugging Locale::Maketext and its odd
    get_handle stuff was impossible to debug.

    --d

    Carl Franks wrote:
    2009/3/25 Gordon Yeong <anexiole@gmail.com>:
    Hi,

    Been using html::formfu for abit. Love the validation and configurability
    behind it:)

    got a very interesting question: How to override standard message, 'This
    field is required'?

    This is the message the comes up when you hit "submit" with an incomplete
    form.
    Those fields that are required which are left blank will have this message,
    'This field is required' displayed.
    You can also create your own I18N class to override the default
    messages, so you don't need to put them in your form config.

    The Localize stuff doesn't seem to be very well tested, though - and I
    can't find a way to set it up from a config file, other than
    'localize_class', which will mean you have to define *all* messages in
    your own class, as you'll lose the default FormFu messages.

    I'm not sure why add_localize_object() adds the object to the end of
    an array - this means you can't override default FormFu messages, you
    can only supplement them.
    I'd suggest we change this, to add it to the start of the array.

    I'd also suggest we add a add_localize_class(), so it can be called
    from a config file, such as:
    add_localize_class: 'MyApp::I18N'

    Has anyone been using the I18N methods, and want to chip in?

    I'm also not sure why add_localize_object() expects an object for a
    specific language, where_as 'localize_class' correctly expects the
    base-class, and sets it up with $form->languages()
    Barely any of this is currently tested, so I'd be quite happy to break
    that if it would improve its usability.

    Carl

    _______________________________________________
    HTML-FormFu mailing list
    HTML-FormFu@lists.scsys.co.uk
    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
  • Carl Franks at Mar 26, 2009 at 9:43 am
    2009/3/26 Daisuke Maki <daisuke@endeworks.jp>:
    May I suggest <plug>Data::Localize</plug>?

    I wrote it specifically cause debugging Locale::Maketext and its odd
    get_handle stuff was impossible to debug.
    Great - I'll look into it!

    Cheers,
    Carl

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouphtml-formfu @
categoriesperl, catalyst
postedMar 25, '09 at 11:08a
activeMar 26, '09 at 9:43a
posts5
users4
websitemetacpan.org...

People

Translate

site design / logo © 2022 Grokbase