Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
6 replies
Subscribers
6 subscribers
Views
2283 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Process
I need to be able to check a text variable for HTML tags when our Users copy and
sswilliams
over 9 years ago
I need to be able to check a text variable for HTML tags when our Users copy and paste text into a form. I want to be able to 'strip' the HTML tags from the text variable if a User does a copy an paste, else just store the data in the text variable. I have used the following expressions and none of them seem to work:
if(contains(pv!projectDescription,"SPAN"),striphtml(pv!projectDescription),pv!projectDescription)
if(like(pv!projectDescription,"SPAN*"),striphtml(pv!projectDescription),pv!projectDescription)
if(find(pv!projectDescription,"SPAN")>0,striphtml(pv!projectDescription),pv!projectDescription)
Is there a way to check a text variable for HTML tags and strip the tags so that the data will display without the tags in the up coming forms?
OriginalPostID-204473
OriginalPostID-204473
Discussion posts and replies are publicly visible
0
Tim
Certified Lead Developer
over 9 years ago
Is there any need to actually test for HTML? Why not just run striphtml() over pv!projectDescription every time?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sswilliams
over 9 years ago
Some Users do a copy and paste and the striphtml() is needed. For Users who do not copy and paste but use formatting on the text (bullets, underline, insert a weblink, etc.) the striphtml() function removes the formatting that is needed. So if I could check for html, then the variable that does not have the tags would remain intact.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
Certified Lead Developer
over 9 years ago
I think you may just need to manually check for whatever HTML tags you disallow and strip them out manually using normal text functions.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 9 years ago
You can use a regex expression for this, though you'll need to install the regex functions plugin. An expression something like /(<script(\\s|\\S)*?<\\/script>)|(<style(\\s|\\S)*?<\\/style>)|(<!--(\\s|\\S)*?-->)|(<\\/?(\\s|\\S)*?>)/g will do what you want.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 9 years ago
Also if you're wondering whether that expression will work, check out
http://regexr.com/
- a very useful regex tool.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sswilliams
over 9 years ago
I tried that in a script task using the expressions indicated in my initial questions. However the contain(), like(), and find() functions do not seem to recognize that there is any html in the variable. Is there something specific that I can check for? I have tried checking for:
"<", "SPAN", "<SPAN", "<SPAN*"
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel