Textfield to allow only digits and symbols.

Home Forums Quform WordPress Textfield to allow only digits and symbols.

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24232
    Harrison
    Participant

    Does anyone know how can I set up the filters to accept only digits and symbols? If a letter is included, then a message should say that only digits and symbols are allowed.
    I tried adding these regex /[^0-9\/]+/ or /^[^0-9\/]+$/ but it doesn’t work. It still accepts letters.

    Any help is really appreciated.
    Thanks

    #24234
    Harrison
    Participant

    Okay, I got it solved by adding a regex to allow only numbers and dashes.

    /^[0-9-_]*$/

    #30420
    erman4764
    Participant

    I want to write for friends who do not know;

    This worked for me;

    Forms – Settings – Custom CSS & JS – Custom JavaScript.
    Paste code below. Dont forget to replace unique id of that item.

    $(‘.quform-field-1_12’).keyup(function (event) {
    $(this).val(function (index, value) {
    return ‘$’ + value.replace(/\D/g, “”).replace(/\B(?=(\d{3})+(?!\d))/g, “,”);
    });
    });

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy