Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Input form - avoiding special characters in text field

Avatar

Avatar
Validate 10
Level 3
Partha18
Level 3

Likes

19 likes

Total Posts

29 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 3
Partha18
Level 3

Likes

19 likes

Total Posts

29 posts

Correct Reply

2 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
Partha18
Level 3

19-06-2020

Hi Team,

In a custom input form, we have a text field. Here we need to avoid few special characters like @ $ % etc.,

How can i make it possible?

 

For example,

<input xpath="@textField"/>

 

Thanks and regards,

ParthaSarathy.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
MVP
kapilKochar
MVP

Likes

128 likes

Total Posts

140 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Contributor
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
MVP
kapilKochar
MVP

Likes

128 likes

Total Posts

140 posts

Correct Reply

43 solutions
Top badges earned
Validate 1
Contributor
Give Back 10
Give Back 5
Give Back 3
View profile
kapilKochar
MVP

21-06-2020

Hi ,

 

You can use Regex for this. 

 

In your form use Leave tag like below and use soapcall tag and specify new function which you will create in JavaScript file. 

<leave>

<soapCall name="functionName" service ="">

<param exprIn="[give full path of field you want to check]" type="string"/>

</leave>

 

Make sure : In Javascript file , function you define have syntax like below 

namespace_schema_fucntionName(test)

{

var res= test.match(); // Use regex here to find special character

if(res==null)

{

 alert("special character found")

}

}

 

Thanks,

Kapil

Answers (1)

Answers (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

957 likes

Total Posts

1,079 posts

Correct Reply

506 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

957 likes

Total Posts

1,079 posts

Correct Reply

506 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

19-06-2020

Hi,

 

You can check on form save/close with:

<check expr="@textField not like '%@%' and ..."><error>Invalid character</error></check>

 

To replace *all* special characters with '_', at a schema level, use dataPolicy="identifier" on the attribute- no form work needed.

 

Thanks,

-Jon