Validation Regex For ONLY UPPERCASE combination of letters and or numbers without using script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 12:52 PM - edited 09-30-2024 03:30 PM
Hello,
Please I need a Regex Validation that only allows ALL CAPS combination of letters and or numbers in string fields without writing scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 01:22 PM - edited 10-01-2024 01:23 PM
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!
MVP 2025 ✨
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 02:21 PM
@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.