Jump to:

22996 Posts in 11844 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » NumericField() and negative numbers

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1270 Views
  • DeklinKelly
    Avatar
    Community Member
    196 Posts

    NumericField() and negative numbers Link to this post

    NumericField() does not support negative numbers. If I supply "-100" it returns:

    '-555' is not a number, only numbers can be accepted for this field

    Is this a bug or am I missing something?

  • Samba Sam
    Avatar
    Community Member
    85 Posts

    Re: NumericField() and negative numbers Link to this post

    I get the same error in my custom CMS tab when I try to enter a negative number into the Int field.

    For example,
    With this
    public static $db = array(
          'TopMargin' => 'Int',
       );

    and this
    ...
    new NumericField("TopMargin", "Top Margin"),
    ...

    I get "'-20' is not a number, only numbers can be accepted for this field".
    As a result, I am having to use TextField instead.

    Perhaps I am missing somethings as well? Negative integers are numbers.

    Anyone have any ideas?

    Thanks,
    Sam

  • mobius
    Avatar
    Community Member
    54 Posts

    Re: NumericField() and negative numbers Link to this post

    Looks like a bug. I've opened a ticket and posted a patch here: http://open.silverstripe.org/ticket/5116

    1270 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.