• Resolved amaroak

    (@amaroak)


    hi

    i have a issue with the min and the max, when use the arrow you can go with negative number, for that i found this code

    <script type="text/javascript">
    jQuery(document).ready(function($) {
        //Impresiones
    //Input Impresion y Fotocopiado
    $('#forminator-field-number-1').attr('min', 1);
    $('#forminator-field-number-2').attr('min', 0);
    //Numero para Form Fotocopiado
    $('#forminator-field-number-3').attr('min', 0);
    
    });
    </script>

    but for some reason, i can still put negative numbers in the field

    the field is number-2, and i have set this way
    https://ibb.co/qkxLtZP

    If i put minimun number in 1, it’s works, but i need put 0 in the form

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @amaroak,

    I hope you are doing well today!

    As I checked, number field works well with its min and max values, can you please elaborate the issue a little bit more and what you want to achieve. Also please share an export of the form with us as well to be able to check further and the link to the page you have the form.

    You can find more info on how to export the form here : https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export

    After exporting, please share the code using a service such as https://pastebin.com which is free to use.

    Please always make sure to use such service to share the code and don’t post the code here directly as it will most likely be unusable.

    Kind regards,
    Zafer

    Thread Starter amaroak

    (@amaroak)

    Thanks

    https://pastebin.com/9U3iLVGv

    The field is:
    Además de la impresión, ?Cuántas copias necesita?
    {number-2}

    and i have the script in my footer.php, that works with the mín is 1, like in the field {number-1} but when i put 0 in the min and max in the form, doesn’t work

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @amaroak,

    I checked the code on a test website and confirmed it’s working as expected.

    Since the new update, we have improved how the form field IDs are generated to make them unique. The Forminator will now add a unique ID along with all the fields on the form, so you need to update the above code with the new ID.

    Can you please share a page URL where we can find the form so we can help you further?

    Kind Regards,
    Nebu John

    Thread Starter amaroak

    (@amaroak)

    for your answer : so you need to update the above code with the new ID.

    how I do this?

    Regarding the forms, I have them in private, since I am still working on them, and regarding this I have not published them yet, so if I send you the link you will not be able to review them either

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @amaroak

    In your code you use:

    #forminator-field-number-1
    #forminator-field-number-2
    #forminator-field-number-3

    Please visit your page with your form and check page source. Look for ID’s which start:

    forminator-field-number-1
    forminator-field-number-2
    forminator-field-number-3

    You should see them now like:

    id="forminator-field-number-1_6332bd1dcfbb5
    id="forminator-field-number-2_6332bd1dcfbb5
    id="forminator-field-number-3_6332bd47006d0

    Note this is the example above.

    Based on your unique ID’s now you will need to update your code.

    Hope this helps.

    Kind Regards,
    Kris

    Thread Starter amaroak

    (@amaroak)

    Hi @wpmudevsupport13

    I just tried how they mention me, it still doesn’t work, and it still works like I had with the other fields, but for the one I need, it still doesn’t work

    In my Code i Use:

    $('#forminator-field-number-1').attr('min', 1);
    //  $('#forminator-field-number-1').attr('max', 999);
    $('#forminator-field-number-2').attr('min', -1);
    //  $('#forminator-field-number-2').attr('max', 999);
    //Numero para Form Fotocopiado
    $('#forminator-field-number-3').attr('min', 0);

    I just took your recommendation, and it still doesn’t work
    $('#forminator-field-number-2_63343e9864436').attr('min',0);

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @amaroak

    Thank you for response!

    As tested by my colleagues already, the code worked fine but since it’s JS code it’s a bit “fragile”. I’m wondering if it’s correctly executed and not conflicting with anything on your site.

    Would you mind sharing a link to the page with the form (with the code still being added to the site) so we could take another look at it “from outside” – but on actual page where it’s used?

    Best regards,
    Adam

    Thread Starter amaroak

    (@amaroak)

    Hi @wpmudev-support8

    Yeah Sure, you need to go to step 2 of the form in the field “Además de la impresión, ?Cuántas copias necesita?” which has a default value of 0 and in the limits it is set at min 0 and max 999, but I can still go negative

    https://deg.ing.uc.cl/impresion/

    The other thing that I noticed is that the id of the fields that were mentioned above, is constantly changing when reloading the web
    #forminator-field-number-2_63343e9864436 <—– it changes every time I refresh the form

    Thanks!

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @amaroak,

    The IDs are dynamic and hence you notice it changes after every refresh, could you please try this code and see whether it helps?

    
    jQuery(document).ready(function($) {
        //Impresiones
    // Input Impresion y Fotocopiado
    $('#number-1 > div > input').attr('min', 1);
    
    $('#number-2 > div > input').attr('min', 0);
    
    //Numero para Form Fotocopiado
    $('#number-3 > div > input').attr('min', 0);
    
    });

    Where number-1 would represent the #forminator-field-number-1 and number-2 forminator-field-number-2 etc

    Please do let us know how that goes.

    Kind Regards,
    Nithin

    Thread Starter amaroak

    (@amaroak)

    Hi @wpmudevsupport11

    Now it works great, thanks a lot guys! I thank you very much

    You can close the topic

    Have a nice day!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘min and negative number w/arrow’ is closed to new replies.