Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

Percent validation

Avatar

Level 7

How I can add a "%" sign to a Numeric fields and put a limit of 100%?

IN case user enter more than 100% inform them that they can not enter more than 100 and then focus to numeric field again.

Thanks for your help

1 Accepted Solution

Avatar

Correct answer by
Level 10

Set the display pattern like below..

     num{zz9.88'%'}

Place the below script int he exit event of the Numeric field.

     if(parseFloat(this.rawValue)>100){
           xfa.host.messageBox("The Percent should not be more than 100%","Percent",0,0);
           xfa.host.setFocus(this);
     }

Thanks

Srini

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Set the display pattern like below..

     num{zz9.88'%'}

Place the below script int he exit event of the Numeric field.

     if(parseFloat(this.rawValue)>100){
           xfa.host.messageBox("The Percent should not be more than 100%","Percent",0,0);
           xfa.host.setFocus(this);
     }

Thanks

Srini