- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2019 03:41 AM
We need to prevent users from entering double quotes and the "enter" key (ie a new line) into a comments field which is multiline.
We've created an on change client script, but the alert displays even if there is no double quote or new line in the field.
We've tried to use an example from another post but can't seem to get the correct values in the regEx var?
Our script is:
//check for double quotes or new line/enter
var str = g_form.getValue('u_comments');
var regEx = /"\n\r/;
var valid = regEx.test(str);
if(!valid)
alert('The comments field must not contain double quotes or Enter/New Line');
return false;
}
the alternative option is to replace double quotes and 'enter' with a space when the form is submitted - so happy to have that option as well.
thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2019 06:41 AM
If you want to do this in a client script you could use JavaScript indexOf() to determine if a quote exists. Something like this untested code:
var comment = g_form.getValue('u_comment');
if (comment.indexOf('"') >= 0) {
alert('Hey, there is a quote here. Not good');
}
Footnote on the dictionary attribute, it caps the string limit at 255 characters, but for a comment, that's still a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2019 07:04 AM
perfect! thank you - have a great weekend!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 01:45 AM
Hi Chuck,
could you please elaborate on the steps that are required to create such an "is_multi_text=false" attribute?
It is not in the Dictionary Attributes table (sys_schema_attribute_list) out of the box so I cannot select it directly on a field dictionary entry, and there are quite a few values that one need to determine if you would like to add it (label, name, applies to, on table, column type, value type).
Many thanks in advance!
Tamas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 04:30 AM - edited 02-16-2024 04:30 AM
I've found the solution:
https://www.youtube.com/watch?v=GelWXWy6Jc4&t=1941s
The key is to click "advanced view" so you can insert the attribute in the text field that appears.
You should not look for this feature in the related lists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 02:00 AM - edited 02-14-2024 02:05 AM
/ Sorry, duplicate /