• Resolved futureyoon

    (@futureyoon)


    Hi

    In the simple text input field, is there a way to accept only alphanumeric value (english and number)?
    I don’t see any condition to fliter that.

    Or can I use ‘custom html’ to build something like that? if so, any sample?

    Please kindly advise me on that.

    Thank you

    • This topic was modified 2 years, 4 months ago by futureyoon.
    • This topic was modified 2 years, 4 months ago by futureyoon.
    • This topic was modified 2 years, 4 months ago by futureyoon.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Tahmid ul Karim

    (@tahmidulkarim)

    Hi @futureyoon,

    There isn’t any direct option to set the simple text field to only accept alphanumeric values. You would have to use custom JS codes for that.

    With JS codes, you can use this regex code to check for alphanumeric values –

    /^[a-z0-9]+$/i

    Thank you.

    Thread Starter futureyoon

    (@futureyoon)

    Hi Karim,

    Thank you for the update.
    Just curious if you have sample JS codes doing such thing? I am sorry I am not so techy writing such code myself.

    Thank you

    Plugin Support Tahmid ul Karim

    (@tahmidulkarim)

    Hi @futureyoon,

    Here is example JS code snippet –

    let text_field = document.querySelector("#ff_34_input_text");
    
    text_field.addEventListener('input', function(e) {
        e.target.value = e.target.value.replace(/[^a-zA-Z0-9]/g, '')
    });

    Please note that adding the code directly to your form won’t work. You have to change the selected field inside the querySelector and add your specific field ID.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘alphanumeric value’ is closed to new replies.