[Jifty-commit] r1058 - in jifty/trunk: lib/Jifty/Web/Form/Field

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon May 15 08:28:40 EDT 2006


Author: jesse
Date: Mon May 15 08:28:39 2006
New Revision: 1058

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm

Log:
 r13792 at hualien:  jesse | 2006-05-15 08:26:34 -0400
  The second attachment is a patch for the Checkbox widget as I think
  a checbox checked accordingly the current_value is nicer than the raw value.
 
  - Frederic Blank
 


Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm	Mon May 15 08:28:39 2006
@@ -41,6 +41,27 @@
     '';
 }
 
+=head2 render_value
+
+Renders value as a checkbox widget.
+
+=cut
+
+sub render_value {
+    my $self  = shift;
+    my $field .= qq!<input type="checkbox"!;
+    $field .= qq! name="@{[ $self->input_name ]}"!;
+    $field .= qq! id="@{[ $self->element_id ]}"!;
+    $field .= qq! value="@{[$self->value ||1]}"!;
+    $field .= $self->_widget_class;
+    $field .= qq! checked="checked"! if ($self->checked or $self->current_value);
+    $field .= qq! disabled readonly!;
+    $field .= qq! />\n!;
+
+    Jifty->web->out($field);
+    return '';
+}
+
 =head2 javascript_preempt
 
 By default, javascript (such as onclick handlers) should not actually


More information about the Jifty-commit mailing list