Commit ea25c5cf authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 1198659: Custom fields of type INTEGER should accept negative integers

r=gerv a=sgreen
parent 7d3c1b0d
...@@ -2259,7 +2259,7 @@ sub _check_integer_field { ...@@ -2259,7 +2259,7 @@ sub _check_integer_field {
ThrowUserError("number_not_integer", ThrowUserError("number_not_integer",
{field => $field, num => $orig_value}); {field => $field, num => $orig_value});
} }
elsif ($value > MAX_INT_32) { elsif (abs($value) > MAX_INT_32) {
ThrowUserError("number_too_large", ThrowUserError("number_too_large",
{field => $field, num => $orig_value, max_num => MAX_INT_32}); {field => $field, num => $orig_value, max_num => MAX_INT_32});
} }
......
...@@ -42,7 +42,10 @@ ...@@ -42,7 +42,10 @@
name="[% field.name FILTER html %]" name="[% field.name FILTER html %]"
value="[% value FILTER html %]" size="40" value="[% value FILTER html %]" size="40"
maxlength="[% constants.MAX_FREETEXT_LENGTH FILTER none %]" maxlength="[% constants.MAX_FREETEXT_LENGTH FILTER none %]"
[% IF field.type == constants.FIELD_TYPE_INTEGER %] pattern="\d+[% IF dontchange %]|[% dontchange FILTER html %][% END %]" [% END %] [% IF field.type == constants.FIELD_TYPE_INTEGER %]
pattern="-?\d+[% IF dontchange %]|[% dontchange FILTER html %][% END %]"
title="The value must be a valid positive or negative integer"
[% END %]
[% IF field.is_mandatory %] [% IF field.is_mandatory %]
data-required="true" [% 'aria-required="true" required' UNLESS field_hidden %] data-required="true" [% 'aria-required="true" required' UNLESS field_hidden %]
[% END %]> [% END %]>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment