• Resolved FeniXx

    (@fenixx)


    If I insert a field with input type number, the step is automatically set to 0.01. Which, for example, in the case of values ​​where I want to set the number of people, using arrows, leads to the fact that I cannot enter, for example, 2 people or more from 1. Nowhere in the field or form settings did I find an option to set the step for the number.

    Regards, Petr

Viewing 15 replies - 1 through 15 (of 20 total)
  • Hi @fenixx

    I hope you are doing well today.

    If I understand correctly your number field has Minimum value set up as 1 and by default, it displays 0.01 value. If so, I cannot replicate this issue.

    Can you share page URL where this form is located so that we can be on the same page when it comes to this issue?

    Also, please export your form, upload it to google drive and share a link in your next reply so we could review your field settings.

    Kind Regards,
    Kris

    Thread Starter FeniXx

    (@fenixx)


    Good day, no, this is the problem that when I enter an input of type number, if I want only whole numbers to be entered (1,2,3,4 ..) then this cannot be done using the arrows at the input, as it is automatically set to step to a value of 0.01. It would be good to be able to set the step I want for each input.

    Here is a link to the generated sample.

    https://webshare.cz/#/file/yTgeNbniEx/formator-demo-form-export-1-txt

    Plugin Support Williams – WPMU DEV Support

    (@wpmudevsupport3)

    Hi @fenixx,

    Hope this message finds you well.

    I imported your form into my test site but I was not able to reproduce the issue, only integer numbers work on the field:

    https://prnt.sc/anLAP5jW84Cy

    If I manually added decimals it will return an error:

    https://prnt.sc/1gOmXKhF5gYd

    Could you share a screenshot of your form and the value you are getting?

    Best regards,
    Laura

    Thread Starter FeniXx

    (@fenixx)

    Hello, here is a short video about the described problem.

    forminator_number_issues.mp4 | Webshare.cz – moderní úložiště pro Vaše data

    For example, I enter the value 1 and then using the arrows on the right I want to increase to the value 2,3, … and unfortunately the value 1.01 is entered automatically and it is corrected to the value 1. This is caused by the parameter step=0.01, which cannot be changed.

    I use wordpress with Czech localization.

    • This reply was modified 2 years, 3 months ago by FeniXx.
    • This reply was modified 2 years, 3 months ago by FeniXx.
    Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hi @fenixx

    Thank you for sharing the video.

    I can see the problem there but I still can’t replicate this.

    Here’s how it works for me:

    https://app.screencast.com/sBntJvDo0KIU1

    This is the exact form that you exported for us (no changes made to it at all), imported to one of my test sites – basic setup, with just a default theme and no other plugins besides Forminator.

    Since you used “Preview” mode for the video, I also tested this way and yet it behaves the way it is expected and as it should.

    It seem then that the issue would be related to some sort of conflict happening on your setup (that may be with other plugin or theme or some custom code) and that needs to be identified first.

    That being said:

    1. you mentioned “parameter step=0.01” – where exactly do you see it? Forminator doesn’t have anything like that so I’m either missing something or it’s coming from other code on site(e.g. other plugin)

    2. could you share additional information about your site’s setup? To do so, go to the “Tools -> Site Health” page -> “Info” tab in site’s back-end, click on “Copy site info to clipboard” button there and post copied data in response here (mark it as code possibly).

    3. if you do have other site(s) – are you experiencing the same issue there; if you didn’t test, could you give it a try?

    Kind regards,
    Adam

    Thread Starter FeniXx

    (@fenixx)

    Good day, you are right, one plugin was causing it. However, it would be good if it was possible to set the “step” value for each input in the plugin to, for example, 0.01, which I already mentioned. Sometimes it is convenient to use the arrows to step to hundredths/tenths and not whole numbers.

    Thanks for clarifying the issue.

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @fenixx,

    So you want to move only the decimal part in the Number field with arrows? I’m afraid, by default, the plugin only supports changing the whole number or the integer using the arrows and now the decimal.

    It’ll require manually entering the decimal at the moment.

    Could we know what is the exact use cases where changing the decimals is vital via arrows instead of the whole numbers so that we could have a better idea regarding your workflow and check if any improvements could be looked at in future updates?

    Kind Regards,

    Nithin

    Thread Starter FeniXx

    (@fenixx)

    Good day,

    these are calculations in energy in the construction industry, where certain values ​​are normally entered in hundredths and each hundredth has an incredible impact on the final result. That’s why you need the ability to add using arrows and not just overwriting. It is more user friendly.


    <span style=”text-decoration: underline;”>Is it somehow possible to add a hook parameter step=”0.01″ to items with a specific class that I set in the form?</span>

    Best regards Peter

    • This reply was modified 2 years, 3 months ago by FeniXx.
    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @fenixx,

    Just to be sure, you are looking to change the decimal part on the arrow click in the order of 0.1, 0.2, 0.3, right?

    I’m checking with our developer to see if there are any workaround that’s possible regarding such a use case or whether it could be considered as a feature down the roadmap.

    Will keep you posted once we get further feedback asap.

    Kind Regards,

    Nithin

    Thread Starter FeniXx

    (@fenixx)

    Good day,

    I mean zooming like this 0.01, 0.02, 0.03 … using the arrows.

    Best regards Peter

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @fenixx,

    Please check and see whether the following helps:

    <?php
    
    add_action( 'forminator_before_form_render', 'wpmudev_number_field_form_check', 10, 5 );
    function wpmudev_number_field_form_check( $id, $form_type, $post_id, $form_fields, $form_settings ) {
    	if ( 508 == $id ) { // Please change the form ID.
    		add_action( 'forminator_field_number_markup', 'wpmudev_number_field_min_max_fraction', 10, 5 );
    	}
    }
    
    function wpmudev_number_field_min_max_fraction( $html, $id, $required, $placeholder, $value ) {
        if ( false !== strpos( $id, 'number-1') ) { // Please change the number field ID.
            $html = str_replace('step="any"', 'step="0.01"', $html);
    
        }
        return $html;
    }
    

    In the snippet, you’ll need to make sure to update the reference of 508 in the code with your form ID, suppose your form ID is 123 then the following line will change from:

    if ( 508 == $id ) { 

    To:

    if ( 508 == $id ) {

    The number-1 in the code will refer to your Number field ID, you’ll need to update it according to your field ID.

    You can add the code via mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Please do note that the code will only change the decimal part via arrow as seen in the screenshot:

    https://i.imgur.com/ZDnuAjb.png

    Kind Regards,

    Nithin

    Thread Starter FeniXx

    (@fenixx)

    Good day, thanks for sending the code.

    However, I need the step to be “0.01” for all the numbers to which I assign the “des” class. So, is it possible to enter a class instead of one ID, which I assigned a number to the fields?

    Thank you for your feedback, best regards, Petr

    • This reply was modified 2 years, 3 months ago by FeniXx.

    Hi @fenixx

    I pinged our SLS Team to check this and we will get back to you as soon this is possible. Thank you for your patience while we look into this further.

    Kind Regards,
    Kris

    Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello @fenixx,

    Please try adding the following snippet instead of the previous one:

    <?php
    
    add_action( 'forminator_before_form_render', 'wpmudev_number_field_form_check', 10, 5 );
    function wpmudev_number_field_form_check( $id, $form_type, $post_id, $form_fields, $form_settings ) {
    	if ( 1160 == $id ) { // Please change the form ID.
            add_filter( 'forminator_field_markup', 'wpmudev_number_field_min_max_fraction', 10, 3 );
    	}
    }
    
    function wpmudev_number_field_min_max_fraction( $html, $field, $cls ) {
        if ( preg_match('/^your_class_name$/', $field['custom-class'])) { // Please change the class name.
            $html = str_replace( 'step="any"', 'step="0.01"', $html );
    
        }
        return $html;
    }

    Replace 1160 with your form ID on this line:
    if ( 1160 == $id ) { // Please change the form ID.

    and your_class_name with the actual class name on the following line:
    if ( preg_match('/^your_class_name$/', $field['custom-class'])) { // Please change the class name.

    for example:
    if ( preg_match('/^des$/', $field['custom-class'])) { // Please change the class name.

    Hope this helps. Let us know if you have any questions!

    Best Regards,
    Dmytro

    Thread Starter FeniXx

    (@fenixx)

    Good day, thanks for the code but unfortunately when I activate it I get this error

    Warning: Undefined array key „custom-class“ in …./wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 9.

    Line 9 is

    if ( preg_match('/^des$/', $field['custom-class'])) { // Please change the class name.

    I don’t know how to fix this error

    Best regards Peter

Viewing 15 replies - 1 through 15 (of 20 total)

The topic ‘Forminator input type Number – step issues’ is closed to new replies.