Field Validation with MatchText

Sarah Reichelt sarah.reichelt at gmail.com
Thu Jan 10 20:32:24 EST 2008


> My data validation is failing in a strange way.  If I enter the correct
> value, the validation comes back TRUE and everything is ok, but if I put in
> a BAD value, the data validation returns FALSE and displays the correct
> error message.  WORKS AS EXPECTED, BUT  The application returns the user to
> the data entery field with the text selected.  I then enter the data in the
> correct format and from then on the validation always returns FALSE.  I must
> be using something incorrectly or there is a bug.  Here is what I have in RR
> V2.8.1

I tend to steer clear of regex since I don't really understand it, but
testing your scripts I cannot get any entry to return true.

My non-regex version of your checking function is as follows:

function CheckPostalCode tCodeToCheck
    if the length of tCodeToCheck = 5 and tCodeToCheck is a number then
        return true
    else if the length of tCodeToCheck = 10 and char 1 to 5 of
tCodeToCheck is a number and  \
            char 6 of tCodeToCheck = "-" and char 7 to 10 of
tCodeToCheck is a number then
        return true
    else
        return false
    end if
end CheckPostalCode

Assuming I have the format of your post codes correct, this seems to
work perfectly.

Cheers,
Sarah



More information about the use-livecode mailing list