- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-09-2018 02:39 PM
Hello all,
Does anyone know if theres a way to prevent line breaks in a multi line text field?
We have an integration with DocuSign so when the user submits the form it got the error "String contains control character". When comparing to other forms the user had used enter for a new line which caused the issue. If the user just types away and goes onto the second line it was fine.
I want to see if theres a way to prevent the user from clicking enter or if theres a way to remove the line break after the form has been submitted.
Any assistance with this would be greatly appreciated!
Thanks in advance,
Grace
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-12-2018 09:21 AM
Hi Grace,
Please replace trim() for this:
replace(/\r?\n|\r/g, "");
Example:
var str = "test 1\n"+
" test2\n"+
" test 3";
str = str.replace(/\r?\n|\r/g, "");
Result: test 1 test2 test 3
Regards,
Pedro Lopez
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-09-2018 03:13 PM
Hi,
Try to remove the line break by using trim(). Example:
var str = " abc de fog ";
str.trim();
Hope this helps,
Pedro Lopez
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-09-2018 03:15 PM
Thanks Pedro for the reply! Would this be added in the variable attributes?
Thanks,
Grace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-09-2018 03:18 PM
Hi Grace,
In this case, you will need to validate the information contained in your multi line text. You can do it by using an script: OnLoad, OnChange or OnSubmit, depending of your needs. Let me know if you need help with the code.
Regards,
Pedro Lopez
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-10-2018 08:39 AM
Hi Pedro,
Got it thanks. I am not an expert at coding so your help would be greatly appreciated.
Since I want to validate before they submit the item then it should probably onChange correct?
The variable I am trying to validate is "Description" and the field name is description.
Thanks,
Grace