E
E
Exiar2021-12-22 22:31:02
WordPress
Exiar, 2021-12-22 22:31:02

Contact form 7 TEXT validation: how to limit number input?

Can you please tell me how to restrict the input of numbers in Contact Form 7 for a specific TEXT attribute? So that only letters can be entered? Thanks to!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexandra, 2021-12-23
@Aleksa-s

As an option: add a class to the input, and limit it by the class by the script

$(document).ready(function(){
    $(".myclass").keypress(function(event){
        var inputValue = event.charCode;
        if(!(inputValue >= 65 && inputValue <= 120) && (inputValue != 32 && inputValue != 0)){
            event.preventDefault();
        }
    });
});

A
Artem Zolin, 2021-12-23
@artzolin

https://stackoverflow.com/questions/24070092/conta...
Article on kama
https://wp-kama.ru/plugin/contact-form-7-custom-va...
And there is even a plugin
https:/ /wordpress.org/plugins/jquery-validation-fo...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question