Jump to content

Negative numbers in number custom field?


Recommended Posts

I have a custom field that is suppose to have negative and positive numbers. I have setup the custom field with the type as number. However, the record input form only has the ability to enter positive numbers. If I manually enter a negative number I get a message saying to check the field for an error.

Any ideas on how to best record negative numbers? I want to do some calculations on these numbers using php in a template. I also want to sort by these numerical values. The range of the numbers will be -100 to 1000 or more. Should it be possible to enter negative numbers into a number custom field? Is this a bug in the IPS software?

If the number field is not the best solution, what may be a good alternative?

Link to comment
Share on other sites

  • 2 weeks later...

Today IPS support responded to my bug tracker post. Allowing only zero and above is the default functionality. Therefore the following modification needs to be made in order to allow negative numbers:

$form->add( new \IPS\Helpers\Form\Number( 'negative_number', $default, $required, $options = array( 'min' => -100 ) ) );

Does anyone know which template I need to modify?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...