• Resolved asfooo

    (@asfooo)


    Dear Forminator team,

    Unlike text fields, number fields seem to require the mouse cursor to be on them to stay in focus. (In other words: To be able to type in a number field, you have to keep your mouse on the field.)

    For some website visitors, this was disturbing and lead to errors filling out the form.

    Is there a way to change this behaviour? I would like the number fields to behave like text fields in terms of mouse focus: You click once on them and then the focus stays in that field, despite the mouse leaving it.

    I tried different combinations of “Behaviour” settings, but could not find it out. My Forminator version: Version 1.23.3

    Thank you for your assistance!

    Best

    asfooo

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hi @asfooo

    Hope you are doing fine

    The numeric field has a mouseout event that triggers the validation. This make cause a typing restriction when moving the mouse away. This is expected to make sure the values are properly validated.

    In case this check is causing any issues, you can remove this behavior by unbinding the mouseout and mouseover handlers. The following code can be used (change the #number-1 selector to the numeric field name in your form in case it is different):

    <script>
    
    (function($) {
    	
      $('#number-1 input').click(function(){
        $(this).unbind('mouseout mouseover');
        // this will unbind mouseout and mouseover  events when click
    })
    
    </script>

    The above code can be included using a plugin like this: https://wordpress.org/plugins/insert-headers-and-footers/

    Hope this information helps.

    Kind regards

    Luis

    Thread Starter asfooo

    (@asfooo)

    Dear Luis,

    Thank you for the fast and helpful reply! I tried the code and it works.

    I adapted it, so that all number fields on the page behave like text fields now and do not loose focus anymore when the mouse leaves the field.

       $("input[name*='number']").click(function () {
          $(this).unbind("mouseout mouseover");
        });

    Thank you very much, the Forminator support is great!

    Have a nice day,

    asfooo

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘number field focus’ is closed to new replies.