validation on text field how to configure this | Experience Community
Skip to main content
Question

validation on text field how to configure this

  • March 19, 2026
  • 2 replies
  • 32 views

Description 
Aallow users to enter the Cost using either a comma (,) or a decimal point (.) as the separator for fractional values. This change applies only at the survey level.
Validation Cases 
•    Users must be able to enter the amount for cost using:   

  •   Allowed formats:   
  •     Decimal point: 123.45 
  •     Comma as decimal: 123,45 
  •     Commas as thousand separators: 1,000 or 1,000.00 
  •  Both formats should be accepted without error. 

o    Validation constraints:   

  •    Only one decimal separator (either . or ,) is allowed. 
  •     Maximum two digits after decimal. 
  •     Multiple commas are allowed for thousand separators, but the last comma can act as decimal if followed by up to two digits. 

o    Valid Inputs

  •     10000 → integer 
  •     10,000 → thousand separator 
  •     10,000.00 → thousand + decimal point 
  •     00 → decimal point 
  •     10000,00 → decimal comma

Whole numbers

  •     10
  •     100
  •     1000
  •     10000
  •     100000
  •     1000000

    Decimal formats

  •     1,0 → 1
  •     1.0 → 1
  •     1,00 → 1
  •     1.00 → 1

    Thousand separators

  •    1,000 → 1000
  •     1.000 → 1000

    Mixed formats

  •     1,000,0 -> 1000
  •     1.000.0 -> 1000
  •     1,000,00 -> 1000 
  •     1.000.00 -> 1000 

o    Invalid Inputs- 

  •    1000,000
  •     100,0000
  •     1,0000
     

2 replies

  • Level 4 ●●●●
  • March 20, 2026

I think you dont need JS to do this. You can use Regex in the validaton to achive this.


JoseS
Administrator
Forum|alt.badge.img+23
  • Administrator
  • March 23, 2026

Hello ​@Sridharan.Kannan, as ​@jbk mentioned this could be done via Regex. If you need help knowing how to include it into your survey, I’d recommend checking out the following posts.
 


As one of the posts mentioned as well, AI could potentially be a good use here to help you create the specific regular expression that would help you meet your specific use cases. Hope this helps! 😁