[Html-widget] Offer of help / question about H::W status
fireartist at gmail.com
Wed Aug 16 12:55:58 CEST 2006
On 04/08/06, Bogdan Lucaciu <bogdan at wiz.ro> wrote:
> On Fri, 2006-08-04 at 12:08 +0100, Carl Franks wrote:
> > On 02/08/06, Bogdan Lucaciu <bogdan at wiz.ro> wrote:
> > > 2. I should be able to simply add a 'required' marker on elements with
> > > 'All' constraint, that does not interfere with the comment (like a red
> > > asterisk)
> > I don't think that's the way to do it - as the All constraint might be
> > applied to Hidden elements.
> > How about subclassing the base class H::W::Element to add a new
> > accessor, and do what you will with it during as_xml() ?
> That is a good ideea.
> > > 3. I should be able to put a callback constraints that run the
> > > constraint _once_ with all the elements as parameters. Now the callback
> > > is ran multiple times, for every element.
> > I don't think this is correct.
> > The process() method in HTML/Widget.pm loops over the constraints, and
> > for each one, calls $constraint->process( $widget, \%params, $uploads
> > )
> Yes, and $constraint->process runs $self->validate for each param. That
> means the callback is ran multiple times.
I've added a new CallbackOnce constraint - which is only called once
per process() run.
It's callback routine is passed a list of values corresponding to the
list of names used when the constraint is defined.
$w->constraint( 'CallbackOnce', 'foo', 'bar' )->callback(
my ($foo, $bar) = @_;
If the callback fails, the error is still set for each of the param
names. This can be handled better when we eventually implement point
Hmm, I'd better checked if CallbackOnce handles missing parameters correctly...
More information about the Html-widget