[Rt-commit] rt branch, 4.0/zero-in-integer-form-widget, created. rt-4.0.4-79-gb8a4a89
Ruslan Zakirov
ruz at bestpractical.com
Wed Nov 30 11:08:25 EST 2011
The branch, 4.0/zero-in-integer-form-widget has been created
at b8a4a896b4edfa83fb1a5e218172e9f7927e5b48 (commit)
- Log -----------------------------------------------------------------
commit b8a4a896b4edfa83fb1a5e218172e9f7927e5b48
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Wed Nov 30 20:06:59 2011 +0400
make sure 0 not replaced with '' in Integer form widget
diff --git a/share/html/Widgets/Form/Integer b/share/html/Widgets/Form/Integer
index b15a4c7..d4d1b7d 100644
--- a/share/html/Widgets/Form/Integer
+++ b/share/html/Widgets/Form/Integer
@@ -57,6 +57,8 @@ see docs/extending/using_forms_widgets.pod
<span class="hints"><% $Hints %></span>
</div>
<%INIT>
+$_ = '' foreach grep !defined, $CurrentValue, $DefaultValue;
+$DefaultLabel ||= loc( 'Default: [_1]', $DefaultValue );
</%INIT>
<%ARGS>
$Name
@@ -68,15 +70,18 @@ $CurrentValue => '',
$Default => 0,
$DefaultValue => 0,
-$DefaultLabel => loc( 'Default: [_1]', $DefaultValue || '' ),
+$DefaultLabel => undef
</%ARGS>
<%METHOD InputOnly>
-<input type="text" name="<% $Name %>" value="<% $CurrentValue || '' %>" />\
+<input type="text" name="<% $Name %>" value="<% $CurrentValue %>" />\
<%ARGS>
$Name
$CurrentValue => '',
</%ARGS>
+<%INIT>
+$CurrentValue = '' unless defined $CurrentValue;
+</%INIT>
</%METHOD>
<%METHOD Process>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list