- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 06:24 PM
Extract characters and check if the extracted value is a number.
If there is the following value, I want to extract the first 3 characters and determine whether the value is a number.
123-456
If there is no number, print an error message in the field.
Other conditions
Use Client Script
Check with onSubmit
Please let me know if you know.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 07:40 PM
@user_ms Here is the script
function onSubmit() {
//Type appropriate comment here, and begin script below
var textBox= g_form.getValue('text_box');
var pattern = /^\d{3}-/;
if(pattern.test(textBox)){
g_form.showFieldMsg('text_box','correct');
}
else{
g_form.showFieldMsg('text_box','incorrect');
}
return false;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 07:29 PM
HI @user_ms you can use the below script to check 1st 3 characters
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 07:40 PM
@user_ms Here is the script
function onSubmit() {
//Type appropriate comment here, and begin script below
var textBox= g_form.getValue('text_box');
var pattern = /^\d{3}-/;
if(pattern.test(textBox)){
g_form.showFieldMsg('text_box','correct');
}
else{
g_form.showFieldMsg('text_box','incorrect');
}
return false;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 11:29 PM
@user_ms Any further questions on this topic?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 08:57 AM
Sorry for the late confirmation.
I was able to do it that way.
I don't have any further questions on this topics.
Thank you for your help.