Validation Regex For ONLY UPPERCASE combination of letters and or numbers without using script

ID NOBLE
Tera Expert

Hello,

 

Please I need a Regex Validation that only allows ALL CAPS combination of letters and or numbers in string fields without writing scripts

6 REPLIES 6

In this case, you can create a Client Script of type onSubmit, like this:

 

 

function onSubmit() {
    // Get the value of the field (replace 'your_field_name' with the actual field name)
    var fieldValue = g_form.getValue('your_field_name');

    // Define the regex for ALL CAPS letters and numbers
    var regex = /^[A-Z0-9]+$/;

    // Perform validation
    if (!regex.test(fieldValue)) {
        // Show an error message and prevent form submission
        g_form.showFieldMsg('your_field_name', 'Only uppercase letters and numbers are allowed.', 'error');
        return false; // Prevent form submission
    }

    return true; // Allow form submission if validation passes
}

 

 

@ID NOBLE, If my previous answers helped you in any way, please mark it as Helpful, if this answer solved your problem, please mark it as Accept as Solution, thanks!

@Isaac Vicentini Sorry for bothering you please. The new OnSubmit script is displaying submission error. I have attached the error message for more clarity please. 

Thank you so much for your supports.