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

-- 
                                                          Adam Sjøgren
                                                    [EMAIL PROTECTED]

--- /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;
     
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to