[Catalyst] HTML::Widget - AllOrNone with Select and empty values

Ash Berlin ash at cpan.org
Tue Jun 20 15:06:17 CEST 2006


Adam Sjøgren wrote:
> On Fri, 5 May 2006 15:19:33 +0100, Carl wrote:
>
>   
>> Select elements automatically get an "In" contraint added, containing
>> the keys from the element's options().
>>     
>
>   
>> This probably ought to be over-rideable.
>>     
>
> Attached is a patch that makes it so.
>
> Let me know if it should be done differently and I will be happy to
> make another patch :-)
>
>
>   Best regards,
>
>     Adam
>
>   
> ------------------------------------------------------------------------
>
> --- /usr/share/perl5/HTML/Widget/Element/Select.pm.orig	2006-06-20 14:07:14.000000000 +0200
> +++ /usr/share/perl5/HTML/Widget/Element/Select.pm	2006-06-20 14:17:20.000000000 +0200
> @@ -7,7 +7,7 @@
>  
>  *value = \&selected;
>  
> -__PACKAGE__->mk_accessors(qw/comment label multiple options selected/);
> +__PACKAGE__->mk_accessors(qw/comment label multiple options selected no_constraint/);
>  __PACKAGE__->mk_attr_accessors(qw/size/);
>  
>  =head1 NAME
> @@ -69,12 +69,21 @@
>  A list of keys (unique option ids) which will be pre-set to "selected".
>  Can also be addressed as value for consistency with the other elements
>  
> +=head2 no_constraint
> +
> +  $widget->element('Select', 'foo')->no_constraint(1);
> +
> +Override - turn off - the adding of the implicit L<In
> +Constraint|HTML::Widget::Constraint::In>.
> +
>  =head2 $self->prepare( $widget, $value )
>  
>  =cut
>  
>  sub prepare {
>      my ( $self, $w, $value ) = @_;
> +
> +    return if $self->no_constraint;
>      
>      my $name = $self->name;
>      
>   
Wrong list - there is a HTML::Widget maling list (also on lists.rawmode.org)

Ash





More information about the Catalyst mailing list