Hi Mark,

In order to validate that there is nothing but alphanumeric characters, use
an expression like "^[A-Za-z0-9]$" - the ^ matches the beginning of the line
and the $ matches the end.  All "[a-z0-9]" would match is that there is an
alphanumeric character in the string at all.  The carat-dollar confusion is
such a big topic in regex circles and we were originally considering adding
them automatically.  Let me know if it works for you :)

Hope this helps,
David Churvis

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Fuqua
Sent: Tuesday, February 05, 2008 11:38 AM
To: [email protected]
Subject: [plum] Plum validate input

I love plum and today I saw Adam post a reply on cftalk...maybe there is
hope for the world after all.

Has any one on the list (is any one still on the list?) used the regular
expression attribute of the validateinput tag?

I was trying to use a simple regex yesterday (disclaimer:  I don't really
understand regular expressions) and wasn't able to get it to work.  I was
trying to verify that the input had no special characters and no spaces.  I
tried a bunch of different combinations, but this is the one I most thought
should work.  [a-z0-9].

Whatever I tried, it either passed every input or failed every input,
irregardless of whether or not there were special characters or spaces.

Then I had this crazy idea that I should add quotes to the lines in the
validateinput tag that do the check as so...

Take the existing REFind:

<!--- Evaluate against a regular expression --->
                <cfif Len(Trim(Attributes.regularExpression))>
                        <cfif REFind(Attributes.regularExpression,
Attributes.value) EQ 0>
                                <cfthrow type="Validation.InvalidData"
        
message="#Attributes.regularExpressionMessage#"
                                                errorCode="62200">
                        </cfif>
                </cfif>

And add some quotes:

<!--- Evaluate against a regular expression --->
                <cfif Len(Trim(Attributes.regularExpression))>
                        <cfif REFind("Attributes.regularExpression",
Attributes.value) EQ 0>
                                <cfthrow type="Validation.InvalidData"
        
message="#Attributes.regularExpressionMessage#"
                                                errorCode="62200">
                        </cfif>
                </cfif>

But that didn't work either.



Any ideas?

Mark Fuqua



**********************************************************************
You can subscribe to and unsubscribe from lists, and you can change
your subscriptions between normal and digest modes here:

http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
**********************************************************************


**********************************************************************
You can subscribe to and unsubscribe from lists, and you can change
your subscriptions between normal and digest modes here:

http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
**********************************************************************

Reply via email to