Thanks very much for the reply.  I don't seem to be able to get it to work
however.  Every combination gets sent back.  Here's how I used what you
sent:

<cf_ValidateForm
errorLocation="#Application.absoluteUrlRoot#/JobAdmin/Jobs/JobsAddForm.cfm">
        <cf_ValidateInput variableName="Form.JobName" label="Job Name"
validationType="varchar(50)" required="yes">
        <cf_Validateinput variableName="Form.JobFolder" label="Job Folder Name"
validationType="varchar(50)" required="yes"
regularExpression="^[A-Za-z0-9]$" regularExpressionMessage="Only a-z and 0-9
please.  No spaces or special characters">
        <cf_ValidateInput variableName="Form.JobContact" label="Job Contact"
validationType="varchar(50)" required="No">
        <cf_ValidateInput variableName="Form.JobContactNumber" label="Job 
Contact
Number" validationType="varchar(50)" required="No">

Any idea what I might be doing wrong?

Mark

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of David
Churvis
Sent: Tuesday, February 05, 2008 12:06 PM
To: [email protected]
Subject: RE: [plum] Plum validate input


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
**********************************************************************



**********************************************************************
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