>Hey All,
>
>I have a table that I'm validating against...the fied I'm checking is called Pat_id. The format is 123-4567-89910. And the field is all character.
>
>How can I check to verify that the format of the id is 3, hyphen, 4, hyphen, 5.
>
>
>how can I create a class that handle that chcking
Jeff, if you can exclude the '-' characters from the internal storage format, you can set the Format property to 'R', and use an InputMask of '999-9999-99999'; the '-' will not be included in the value saved. The 'R' excludes any non-mask characters in the InputMask being saved; '-' is not a mask character, and the '9' character accepts a digit or sign, and obviously, people can arrow around to force a blank if they really want to hurt themselves; you then can validate by:
RETURN IIF(LEN(CHRTRAN(this.Value,'0123456789','')) = 0,.T.,0)
The result is that you get to proceed to the next field if the test is passed, and otherwise you remain in the field without the annoying error box. If you don't mind the standard VFP Valid failure message popping, simply:
RETURN (LEN(CHRTRAN(this.Value,'0123456789','')) = 0)