Sharon Jolly wrote:
Hi,
I am part of a project where in a form i have 3 field where the user can enter amount values and my requirement is i need to allow the user to enter amount in the following formats.
1. user can enter the amount alone.
2. It should allow only 2 decimal places to be entered.
3. User can append a $ sign in the beginning
4. User can give "," (Coma's) to indicate 1000, 100 ets eg. 10,000.
5. the amount validators are not mandatory. So this validation should happen only if the user enter an amount into the amount field.
I am using xdoclet to generate my form from the domain object and am using this same domain object for another screen also for listing. So i need to give struts-validator entries on top of the amounts getter method. If any one has the xml regular expression for accomodating this please be of help. Could someone help me out in writing a custom validator for this and tell me how effictely to do it. I would appreciate it if you could respond immediately as the requirement is urgent and of high priority.


Sharon - I don't think you would need a custom validator, just use the mask validator with the proper regular expression. This guy builds and explains a currency validating regegexp that should work in validator pretty easily:

http://www.phpbuilder.com/columns/dario19990616.php3

(see page 2)


Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to