Expand my Community achievements bar.

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