Allow only * and number in a string field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 11:00 PM - edited 11-16-2023 11:08 PM
Dear Team,
Good day!!!
I want to allow astrick (*) and the number in a string field. I know for excluding all the special characters. In that, how to exclude only * is confusing. pls help
Thanks
It worked for me...
var pattern =/^[0-9'"_*]*$/;
var name = g_form.getValue('formula_number');
if (!pattern.test(name)){
alert("Only Numbers and * are allowed in this field");
g_form.setValue('formula_number','');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2023 01:50 PM
Hi, unfortunately your question\requirement is not clear as to the format of your data.
Is this to match any number of decimal characters and any number of *, in any order?
Or are you trying to match an exact pattern?
Perhaps you could provide examples?