Jump to content

[BUG 4.7.5] Wrong error text for Helper Form Number field when using a minimum value


Recommended Posts

Create a simple form with a number field with a minimum number required and an unlimited option with a 0 value:

$form = new \IPS\Helpers\Form;

$form->add( new \IPS\Helpers\Form\Number( 'test', 0, FALSE, array( 'min' => 2, 'unlimited' => 0, 'unlimitedLang' => 'disabled' ) ) );

 

Now load the form, uncheck the Disabled checkbox, and submit the form. Once you've done all the steps this is the error that appears right under the number field:

Quote

The value must be larger than 2.

 

The error makes you believe you have to insert at least 3 but the field does indeed accept a 2 value. The correct error should instead be:

Quote

The value must be at least 2.

Link to comment
Share on other sites

7 hours ago, teraßyte said:
$form->add( new \IPS\Helpers\Form\Number( 'test', 0, FALSE, array( 'min' => 2, 'unlimited' => 0, 'unlimitedLang' => 'disabled' ) ) );

 

change the default value to `2` instead of `0`(second parameter) and try.
 

$form->add( new \IPS\Helpers\Form\Number( 'test', 2, FALSE, array( 'min' => 2, 'unlimited' => 0, 'unlimitedLang' => 'disabled' ) ) );


 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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