• Resolved rmb2021

    (@rmb2021)


    I have a number field that allows a user to select the number of items they want to purchase for $5 each. The limit setting is set to a minimum of 0, yet it allowed a user to enter a negative number, which then deducted $5 for each number below 0 from the total.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @rmb2021,

    I am sorry to know that you are experiencing an issue.

    Could you please share an export of the form so we can take a closer look at how the form is configured?

    Please find more about how to export a form in our documentation here: https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export

    Please share the export as a text file using DropBox or Google Drive.

    Kind Regards,
    Nebu John

    Thread Starter rmb2021

    (@rmb2021)

    Form export file

    Note: Since observing the error, I did change from default error to custom error on that field, to see if that made a difference. It did not seem to have any impact, as it still allows a negative value.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @rmb2021

    Thank you for the form,

    It is expected to allow the negative number, but it should trigger a warning:

    https://monosnap.com/file/m50PW78zG0VmbjXHrnKkylbt66bk21

    You can apply a conditional to the Paypal field to show only if the total is positive as an extra layer of protection, another option is using this hook:

    <?php
    
    add_filter('forminator_field_number_markup', function( $html ) {
        $html = str_replace( 'type="number"', 'type="number" min="0"', $html );
    
        return $html;
    }, 10 );

    But, it would only limit the number control not prevent users from typing -5 for example.

    Best Regards
    Patrick Freitas

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @rmb2021 ,

    We haven’t heard from you for several days now, so it looks like you don’t have any more questions for us.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Negative value bug on number field’ is closed to new replies.