FAQ
Hey guys,

I'm using HTML::Widget; I've created a widget and preloaded it
with values from a database record using ...->value(...).
I've also set up some constraints, so that the fields can be type
checked.

However, I can't get the constraint errors to work. Well they
work if I submit a form, set up the widget and use

$widget->process($c->req)

to load the values in. However when I load the widget from the
record directly using ->value(...) and then $widget->process(),
none of the constraints are triggered.

I'm confused....

So, I'm trying to hack my way around it by creating a 'query' object
to use in place of $c->req the first time around. How do I do that?

Or, how do I do it properly?

Help!

Joe
--
Josef Karthauser (joe@tao.org.uk) http://www.josef-k.net/
FreeBSD (cvs meister, admin and hacker) http://www.uk.FreeBSD.org/
Physics Particle Theory (student) http://www.pact.cpes.sussex.ac.uk/
================ An eclectic mix of fact and theory. =================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20061120/43b11d2f/attachment.pgp

Search Discussions

  • Ash Berlin at Nov 20, 2006 at 11:23 pm

    Josef Karthauser wrote:
    Hey guys,

    I'm using HTML::Widget; I've created a widget and preloaded it
    with values from a database record using ...->value(...).
    I've also set up some constraints, so that the fields can be type
    checked.

    However, I can't get the constraint errors to work. Well they
    work if I submit a form, set up the widget and use

    $widget->process($c->req)

    to load the values in. However when I load the widget from the
    record directly using ->value(...) and then $widget->process(),
    none of the constraints are triggered.

    I'm confused....

    So, I'm trying to hack my way around it by creating a 'query' object
    to use in place of $c->req the first time around. How do I do that?

    Or, how do I do it properly?

    Help!

    Joe
    Firstly there is a HTMLWidget mailing list for this ;)

    Using constraints on input from a database doesn't make sense. If the
    data is invalid it shouldn't make it to the database in the first place.

    Ash
  • Josef Karthauser at Nov 21, 2006 at 6:03 am

    On Mon, Nov 20, 2006 at 11:23:16PM +0000, Ash Berlin wrote:
    Firstly there is a HTMLWidget mailing list for this ;)
    Sure there is; however the HTML::Widget docs talk about a 'query
    object' without defining anywhere in them what a query object actually
    is. By trial and error I've discovered that the result of 'new CGI'
    is one such beast, so also is a Catalyst::Request object, hence asking
    here on this list.
    Using constraints on input from a database doesn't make sense. If the
    data is invalid it shouldn't make it to the database in the first place.
    That's your opinion. Nowhere is it written that data in a database
    conforms to whatever user interface constraints are in force. It is
    perfectly valid to let the user know where an existing record fails
    the constraints.


    So, in the mean time I've discovered the solution to my problem.
    The trick is to do something like:

    $c->request->param($col, $value) if $preload;

    Please please please can someone tidy up the documentation for
    request->param. It makes out that it is a read-only method call.
    (Yes I know there's a caveat about multi-value parameters, which
    gave the game away. It ought to be clearer though!)

    Joe
    --
    Josef Karthauser (joe@tao.org.uk) http://www.josef-k.net/
    FreeBSD (cvs meister, admin and hacker) http://www.uk.FreeBSD.org/
    Physics Particle Theory (student) http://www.pact.cpes.sussex.ac.uk/
    ================ An eclectic mix of fact and theory. =================
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: application/pgp-signature
    Size: 195 bytes
    Desc: not available
    Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20061121/ff7ca605/attachment.pgp

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedNov 20, '06 at 10:46p
activeNov 21, '06 at 6:03a
posts3
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Josef Karthauser: 2 posts Ash Berlin: 1 post

People

Translate

site design / logo © 2021 Grokbase