Form validation question

2009-10-15 Thread Les Irvin

I'm working on a site where people register and choose their own
username.  In the registration form I'd like to, onBlur from the
username field, immediately check to see if that username is already
in use and if so, trigger an alert that returns them to the field.

What's the best way to do this?

Thanks in advance for any help.
Les

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327258
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Form validation question

2009-10-15 Thread Cutter (ColdFusion)

The JQuery Validate plugin has a method whereby, aside from any standard 
checks you put in place (not empty, alphanumeric only, etc), it will 
make an Ajax request and assign a field it's validation status based 
upon the Ajax status return.

http://bassistance.de/jquery-plugins/jquery-plugin-validation/

Steve Cutter Blades
Adobe Certified Professional
Advanced Macromedia ColdFusion MX 7 Developer

Co-Author of Learning Ext JS
http://www.packtpub.com/learning-ext-js/book
_
http://blog.cutterscrossing.com


On 10/15/2009 2:05 PM, Les Irvin wrote:
 I'm working on a site where people register and choose their own
 username.  In the registration form I'd like to, onBlur from the
 username field, immediately check to see if that username is already
 in use and if so, trigger an alert that returns them to the field.

 What's the best way to do this?

 Thanks in advance for any help.
 Les

 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327259
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Tricky Form validation Question (for me at least)

2006-10-10 Thread Les Mizzell
This is probably going to take more javascript than I know how to do, 
since I suck at javascript...

First page of a multi-part form has a drop-down of admin namex to pick from.


select name=selectAdmin
  option value=xoxOther - Enter Information Below!/option
cfloop query=AIData
  option value=#MyData.AdminEmail##MyData.AdminNam1#/option
/cfloop
/select

If you ain't in the list, then you should fill in adminNAME and 
adminEMAIL text fields below that.


I've not quit figured out how to validate this on one page. If Other 
is picked in the select, then I need validation for adminNAME and 
adminEMAIL to happen before the form can be submitted. If Other 
ain't picked, then ignore them...

I can check for this on the NEXT page of the form and force them to fill 
in the blanks there, but I want it to take place all on the first page.



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256130
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Ben Nadel
 
I assume that when the OTHER is selected, the id is ZERO or xox I
didn't know if that was cryptic or not.


// Check for zero option selection
if ( document.form[ 0 ].elements[ selectAdmin ].value == 0 ){
 
// Validate on OTHER admin info

} else {

// Validate on select box data

}


..
Ben Nadel
Certified Advanced ColdFusion Developer
www.bennadel.com
 

-Original Message-
From: Les Mizzell [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 10, 2006 12:27 PM
To: CF-Talk
Subject: Tricky Form validation Question (for me at least)

This is probably going to take more javascript than I know how to do,
since I suck at javascript...

First page of a multi-part form has a drop-down of admin namex to pick
from.


select name=selectAdmin
  option value=xoxOther - Enter Information Below!/option
cfloop query=AIData
  option value=#MyData.AdminEmail##MyData.AdminNam1#/option
/cfloop
/select

If you ain't in the list, then you should fill in adminNAME and
adminEMAIL text fields below that.


I've not quit figured out how to validate this on one page. If Other 
is picked in the select, then I need validation for adminNAME and 
adminEMAIL to happen before the form can be submitted. If Other 
ain't picked, then ignore them...

I can check for this on the NEXT page of the form and force them to fill

in the blanks there, but I want it to take place all on the first page.





~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256132
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Tricky Form validation Question (for me at least)

2006-10-10 Thread Charlie Griefer
if (
 (document.yourFormName.selectAdmin.selectedIndex == 0) 
 (
  (document.yourFormName.theTextFieldName.value == ) ||
  (document.yourFormName.theTextFieldEmail.value == )
 )
   )
{
 alert('you did it all wrong!');
 return false;
}

this assumes that the 'Other' option will always be the first option
in the select list.  if this changes, you can modify the first line of
the 'if' as so:

if (
 
(document.yourFormName.selectAdmin.options[document.yourFormName.selectAdmin.selectedIndex]
..value== xox) 

etc

On 10/10/06, Les Mizzell [EMAIL PROTECTED] wrote:
 This is probably going to take more javascript than I know how to do,
 since I suck at javascript...

 First page of a multi-part form has a drop-down of admin namex to pick from.


 select name=selectAdmin
   option value=xoxOther - Enter Information Below!/option
 cfloop query=AIData
   option value=#MyData.AdminEmail##MyData.AdminNam1#/option
 /cfloop
 /select

 If you ain't in the list, then you should fill in adminNAME and
 adminEMAIL text fields below that.


 I've not quit figured out how to validate this on one page. If Other
 is picked in the select, then I need validation for adminNAME and
 adminEMAIL to happen before the form can be submitted. If Other
 ain't picked, then ignore them...

 I can check for this on the NEXT page of the form and force them to fill
 in the blanks there, but I want it to take place all on the first page.



 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256134
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Mosh Teitelbaum
Ben Nadel wrote:
 if ( document.form[ 0 ].elements[ selectAdmin ].value == 0 ){

Select elements do not have a value property.  Replace value with
selectedIndex (use this capitalization) and the above code should work
fine.

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256135
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Munson, Jacob
That should be document.forms, you left of the 's'.  :) 

 -Original Message-
 From: Ben Nadel [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 10, 2006 10:35 AM
  
 I assume that when the OTHER is selected, the id is ZERO or xox I
 didn't know if that was cryptic or not.
 
 
 // Check for zero option selection
 if ( document.form[ 0 ].elements[ selectAdmin ].value == 0 ){
  
 // Validate on OTHER admin info
 
 } else {
 
 // Validate on select box data
 
 }

--
This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. 

==
EMF idahopower.com made the previous annotations.

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256136
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Bobby Hartsfield
script language=javascript type=text/javascript
function validateForm()
{
var msg = '';
var isValid = true;

if(document.forms[0].selectAdmin.value == 'xox')
{
if (document.forms[0].adminName.value.length == 0)
{
msg = 'Name is required\n';
isValid = false;
}
if (document.forms[0].adminEmail.value.length == 0)
{
msg = msg + 'Email is required';
isValid = false;
}
}

if (!isValid) { alert(msg); }
return isValid;

}
/script

form action=mypage.cfm method=post

select name=selectAdmin
  option value=xoxOther - Enter Information Below!/option
  option value=1Joe Blow/option
/select
br /
Name: input type=text name=adminName /br /
Email: input type=text name=adminEmail /


br /br /
input type=submit onclick=return validateForm(); /
/form

-Original Message-
From: Les Mizzell [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 10, 2006 12:27 PM
To: CF-Talk
Subject: Tricky Form validation Question (for me at least)

This is probably going to take more javascript than I know how to do, 
since I suck at javascript...

First page of a multi-part form has a drop-down of admin namex to pick from.


select name=selectAdmin
  option value=xoxOther - Enter Information Below!/option
cfloop query=AIData
  option value=#MyData.AdminEmail##MyData.AdminNam1#/option
/cfloop
/select

If you ain't in the list, then you should fill in adminNAME and 
adminEMAIL text fields below that.


I've not quit figured out how to validate this on one page. If Other 
is picked in the select, then I need validation for adminNAME and 
adminEMAIL to happen before the form can be submitted. If Other 
ain't picked, then ignore them...

I can check for this on the NEXT page of the form and force them to fill 
in the blanks there, but I want it to take place all on the first page.





~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256137
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Munson, Jacob
 Ben Nadel wrote:
  if ( document.form[ 0 ].elements[ selectAdmin ].value == 0 ){
 
 Select elements do not have a value property.

Actually, 'value' works as long as you give it the value from the form
instead of the index.



--

EMF idahopower.com made the following annotations.
--
This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. 

==


~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256139
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Tricky Form validation Question (for me at least)

2006-10-10 Thread Josh Nathanson
If you are looking for client side validation, CFFORM/CFINPUT is your 
friend.  You don't need to know any javascript to use it, CF writes the 
Javascript for you.  Check the live- or quick-docs for specific usage.

If you are looking to make things a bit more fancy, you could throw an 
onChange event on your select list that would have the second fields 
disabled unless other was selected.  It would be something like

select name=selectAdmin onChange=if (this[this.selectedIndex].value != 
'xox') {document.formname.adminName.disabled = true; 
document.formname.adminEMAIL.disabled = true;}
else {document.formname.adminName.disabled = false; 
document.formname.adminEMAIL.disabled = false;}

That would give your users the info visually that they didn't need to fill 
out the second fields if they are not other.

You would still need to use CFFORM to do validation on the second two fields 
in the case of other.

-- Josh



- Original Message - 
From: Les Mizzell [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Sent: Tuesday, October 10, 2006 9:27 AM
Subject: Tricky Form validation Question (for me at least)


 This is probably going to take more javascript than I know how to do,
 since I suck at javascript...

 First page of a multi-part form has a drop-down of admin namex to pick 
 from.


 select name=selectAdmin
  option value=xoxOther - Enter Information Below!/option
cfloop query=AIData
  option value=#MyData.AdminEmail##MyData.AdminNam1#/option
/cfloop
 /select

 If you ain't in the list, then you should fill in adminNAME and
 adminEMAIL text fields below that.


 I've not quit figured out how to validate this on one page. If Other
 is picked in the select, then I need validation for adminNAME and
 adminEMAIL to happen before the form can be submitted. If Other
 ain't picked, then ignore them...

 I can check for this on the NEXT page of the form and force them to fill
 in the blanks there, but I want it to take place all on the first page.



 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256140
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Ben Nadel
Mosh,

I am pretty sure that select boxes do have a value attribute... Maybe
its not standard?

form
select onchange=alert( this.value );
option value=AONE/option
option value=BTWO/option
option value=CTHREE/option
/select
/form

Works fine for me. 

..
Ben Nadel
Certified Advanced ColdFusion Developer
www.bennadel.com
 

-Original Message-
From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 10, 2006 12:42 PM
To: CF-Talk
Subject: RE: Tricky Form validation Question (for me at least)

Ben Nadel wrote:
 if ( document.form[ 0 ].elements[ selectAdmin ].value == 0 ){

Select elements do not have a value property.  Replace value with
selectedIndex (use this capitalization) and the above code should work
fine.

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/





~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256141
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Dan G. Switzer, II
Ben,

I am pretty sure that select boxes do have a value attribute... Maybe
its not standard?

form
   select onchange=alert( this.value );
   option value=AONE/option
   option value=BTWO/option
   option value=CTHREE/option
   /select
/form

Works fine for me.

That's non-standard syntax, but it works in IE. It shouldn't work in other
browsers.

-Dan


~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256142
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Ben Nadel
Hmmm. I don't do enough client-side stuff I suppose. I have never run
into a problem with it in IE or FireFox (that I can remember), but do
most stuff Server side.

-b
..
Ben Nadel
Certified Advanced ColdFusion Developer
www.bennadel.com


-Original Message-
From: Dan G. Switzer, II [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 10, 2006 1:08 PM
To: CF-Talk
Subject: RE: Tricky Form validation Question (for me at least)

Ben,

I am pretty sure that select boxes do have a value attribute... Maybe

its not standard?

form
   select onchange=alert( this.value );
   option value=AONE/option
   option value=BTWO/option
   option value=CTHREE/option
   /select
/form

Works fine for me.

That's non-standard syntax, but it works in IE. It shouldn't work in
other browsers.

-Dan




~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256144
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Munson, Jacob
Indeed, it works fine in Firefox as well. 

 -Original Message-
 From: Ben Nadel [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 10, 2006 11:11 AM
 
 Hmmm. I don't do enough client-side stuff I suppose. I have never run
 into a problem with it in IE or FireFox (that I can remember), but do
 most stuff Server side.
 
 -Original Message-
 From: Dan G. Switzer, II [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 10, 2006 1:08 PM
 
 I am pretty sure that select boxes do have a value 
 attribute... Maybe
 
 its not standard?
 
 form
  select onchange=alert( this.value );
  option value=AONE/option
  option value=BTWO/option
  option value=CTHREE/option
  /select
 /form
 
 Works fine for me.
 
 That's non-standard syntax, but it works in IE. It shouldn't work in
 other browsers.

EMF idahopower.com made the following annotations.
--
This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. 

==


~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256145
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Ben Nadel
I just checked in the JavaScript Bible 5th Edition (page 710) and they
say that new browsers provide this

WinIE4+ MacIE4+ NN3+ NN6+ Moz1+ Safari1+ 

Doesn't say anything about XHTML or anything like that... But it doesn't
say anything about it not being standard either.

..
Ben Nadel
Certified Advanced ColdFusion Developer
www.bennadel.com
 

-Original Message-
From: Munson, Jacob [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 10, 2006 1:15 PM
To: CF-Talk
Subject: RE: Tricky Form validation Question (for me at least)

Indeed, it works fine in Firefox as well. 

 -Original Message-
 From: Ben Nadel [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 10, 2006 11:11 AM
 
 Hmmm. I don't do enough client-side stuff I suppose. I have never run 
 into a problem with it in IE or FireFox (that I can remember), but do 
 most stuff Server side.
 
 -Original Message-
 From: Dan G. Switzer, II [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 10, 2006 1:08 PM
 
 I am pretty sure that select boxes do have a value 
 attribute... Maybe
 
 its not standard?
 
 form
  select onchange=alert( this.value );
  option value=AONE/option
  option value=BTWO/option
  option value=CTHREE/option
  /select
 /form
 
 Works fine for me.
 
 That's non-standard syntax, but it works in IE. It shouldn't work in 
 other browsers.

EMF idahopower.com made the following annotations.

--
This transmission may contain information that is privileged,
confidential and/or exempt from disclosure under applicable law. If you
are not the intended recipient, you are hereby notified that any
disclosure, copying, distribution, or use of the information contained
herein (including any reliance thereon) is STRICTLY PROHIBITED. If you
received this transmission in error, please immediately contact the
sender and destroy the material in its entirety, whether in electronic
or hard copy format. Thank you. 


==




~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256146
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Tricky Form validation Question (for me at least)

2006-10-10 Thread Charlie Griefer
maybe i'm just old and a creature of habit, but i've always referenced
select elements via the options array.  i've seen people access the
value directly (and i know it works in newer browsers)...but when i
cry a little :)

i have looked into it to see if it's valid (standard) or not...i've
asked people that I consider to be JS gurus...and i've never gotten
any answer other than it works.

i know newer browsers will support it, but i still don't know if it's
standard, so I prefer to stick to the old-fashioned way (FWIW).

On 10/10/06, Ben Nadel [EMAIL PROTECTED] wrote:
 Mosh,

 I am pretty sure that select boxes do have a value attribute... Maybe
 its not standard?

 form
 select onchange=alert( this.value );
 option value=AONE/option
 option value=BTWO/option
 option value=CTHREE/option
 /select
 /form

 Works fine for me.

 ..
 Ben Nadel
 Certified Advanced ColdFusion Developer
 www.bennadel.com


 -Original Message-
 From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 10, 2006 12:42 PM
 To: CF-Talk
 Subject: RE: Tricky Form validation Question (for me at least)

 Ben Nadel wrote:
  if ( document.form[ 0 ].elements[ selectAdmin ].value == 0 ){

 Select elements do not have a value property.  Replace value with
 selectedIndex (use this capitalization) and the above code should work
 fine.

 --
 Mosh Teitelbaum
 evoch, LLC
 Tel: (301) 942-5378
 Fax: (301) 933-3651
 Email: [EMAIL PROTECTED]
 WWW: http://www.evoch.com/





 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256149
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Bobby Hartsfield
I've always used the options array as well but recently have been using
value with no problems or complaints.

-Original Message-
From: Charlie Griefer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 10, 2006 1:41 PM
To: CF-Talk
Subject: Re: Tricky Form validation Question (for me at least)

maybe i'm just old and a creature of habit, but i've always referenced
select elements via the options array.  i've seen people access the
value directly (and i know it works in newer browsers)...but when i
cry a little :)

i have looked into it to see if it's valid (standard) or not...i've
asked people that I consider to be JS gurus...and i've never gotten
any answer other than it works.

i know newer browsers will support it, but i still don't know if it's
standard, so I prefer to stick to the old-fashioned way (FWIW).

On 10/10/06, Ben Nadel [EMAIL PROTECTED] wrote:
 Mosh,

 I am pretty sure that select boxes do have a value attribute... Maybe
 its not standard?

 form
 select onchange=alert( this.value );
 option value=AONE/option
 option value=BTWO/option
 option value=CTHREE/option
 /select
 /form

 Works fine for me.

 ..
 Ben Nadel
 Certified Advanced ColdFusion Developer
 www.bennadel.com


 -Original Message-
 From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 10, 2006 12:42 PM
 To: CF-Talk
 Subject: RE: Tricky Form validation Question (for me at least)

 Ben Nadel wrote:
  if ( document.form[ 0 ].elements[ selectAdmin ].value == 0 ){

 Select elements do not have a value property.  Replace value with
 selectedIndex (use this capitalization) and the above code should work
 fine.

 --
 Mosh Teitelbaum
 evoch, LLC
 Tel: (301) 942-5378
 Fax: (301) 933-3651
 Email: [EMAIL PROTECTED]
 WWW: http://www.evoch.com/





 



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256151
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Bobby Hartsfield
Anyone of these should work fine as the first if() in the function I
posted...

if(document.forms[0].selectAdmin.selectedIndex == 0) {}

if(document.forms[0].selectAdmin.options[0].selected) {}

if(document.forms[0].selectAdmin.value == 'xox') {} 

They seem to all work well across the board for me.

-Original Message-
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 10, 2006 1:53 PM
To: CF-Talk
Subject: RE: Tricky Form validation Question (for me at least)

I've always used the options array as well but recently have been using
value with no problems or complaints.

-Original Message-
From: Charlie Griefer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 10, 2006 1:41 PM
To: CF-Talk
Subject: Re: Tricky Form validation Question (for me at least)

maybe i'm just old and a creature of habit, but i've always referenced
select elements via the options array.  i've seen people access the
value directly (and i know it works in newer browsers)...but when i
cry a little :)

i have looked into it to see if it's valid (standard) or not...i've
asked people that I consider to be JS gurus...and i've never gotten
any answer other than it works.

i know newer browsers will support it, but i still don't know if it's
standard, so I prefer to stick to the old-fashioned way (FWIW).

On 10/10/06, Ben Nadel [EMAIL PROTECTED] wrote:
 Mosh,

 I am pretty sure that select boxes do have a value attribute... Maybe
 its not standard?

 form
 select onchange=alert( this.value );
 option value=AONE/option
 option value=BTWO/option
 option value=CTHREE/option
 /select
 /form

 Works fine for me.

 ..
 Ben Nadel
 Certified Advanced ColdFusion Developer
 www.bennadel.com


 -Original Message-
 From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 10, 2006 12:42 PM
 To: CF-Talk
 Subject: RE: Tricky Form validation Question (for me at least)

 Ben Nadel wrote:
  if ( document.form[ 0 ].elements[ selectAdmin ].value == 0 ){

 Select elements do not have a value property.  Replace value with
 selectedIndex (use this capitalization) and the above code should work
 fine.

 --
 Mosh Teitelbaum
 evoch, LLC
 Tel: (301) 942-5378
 Fax: (301) 933-3651
 Email: [EMAIL PROTECTED]
 WWW: http://www.evoch.com/





 





~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256154
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Mosh Teitelbaum
Ben Nadel wrote:
 I am pretty sure that select boxes do have a value attribute... Maybe
 its not standard?

Ben:

As of the 1.5 standard, I don't believe JavaScript (ECMAScript, whatever)
included a value property for form elements.  As others have said, I've
always used selectedIndex on the options array to get the selected option,
and then referenced that option's value as in:

var formEle = getElementById('formName');
alert(formEle.options[formEle.selectedIndex].value);

All that said, it could be that either value has simply become a
non-standard property to the form element or, because of newer browser's
implementations of the DOM, it has become a semi-standard property.  I
haven't been able to find any standards that suggest its status one way or
the other.  I also didn't spend too much time looking 8^).

According to the latest standards I've seen, value is not standard.  This
could have changed but, because there are so may other ways to get to it and
none of us seem to know for sure whether or not it has become a new addition
to a standard, I'll stick with the other ways of doing it.  But that's
obviously a choice that everyone will have to make on their own.

If anyone decides to do some more testing on this, I'd be interested in
knowing if the form element's value is read/write or read only.  I would
suspect that it's read only but it would be interesting to find out what
happens if you try to write to the property.

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256155
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Munson, Jacob
 If anyone decides to do some more testing on this, I'd be 
 interested in
 knowing if the form element's value is read/write or read 
 only.  I would
 suspect that it's read only but it would be interesting to 
 find out what
 happens if you try to write to the property.

I just tested this, and in both Firefox 1.5 and IE 6, you can change the
selected value in a select box by setting the value property:
document.forms[0].elements[selectAdmin].value = 'item2'



--

--
This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. 

==
EMF idahopower.com made the previous annotations.

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256157
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Dave Watts
 As of the 1.5 standard, I don't believe JavaScript 
 (ECMAScript, whatever) included a value property for form 
 elements.

Well, strictly speaking, this isn't a JavaScript thing as much as an HTML
DOM thing. It's up to the DOM to specify what's what in the browser. In the
case of SELECT fields:

http://www.w3schools.com/htmldom/dom_obj_select.asp

According to this, the VALUE attribute is available for SELECT, and is
writeable. I've never tried to do this, though. I still refer to the values
of options through the options array, because originally that was the only
thing that would work in both Netscape and IE.

 If anyone decides to do some more testing on this, I'd be 
 interested in knowing if the form element's value is 
 read/write or read only.  I would suspect that it's read only 
 but it would be interesting to find out what happens if you 
 try to write to the property.

If the above URL is correct, it's writeable. Again, though, if I want to
change an option's value, I just delete and recreate the option using the
Option constructor.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256161
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Mosh Teitelbaum
Munson, Jacob wrote:
 I just tested this, and in both Firefox 1.5 and IE 6, you can change the
 selected value in a select box by setting the value property:
 document.forms[0].elements[selectAdmin].value = 'item2'

And the GUI updates to reflect the change?  What happens if you try to set
it to a value that is not included in the select list?

Thanks.

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256164
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Munson, Jacob
Yes, the GUI updates, in both Firefox and IE.  Setting the value to an
invalid option is just ignored in Firefox, but in IE the select list is
set to blank (nothing selected). 

 -Original Message-
 From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 10, 2006 1:16 PM
 
 Munson, Jacob wrote:
  I just tested this, and in both Firefox 1.5 and IE 6, you 
 can change the
  selected value in a select box by setting the value property:
  document.forms[0].elements[selectAdmin].value = 'item2'
 
 And the GUI updates to reflect the change?  What happens if 
 you try to set
 it to a value that is not included in the select list?

EMF idahopower.com made the following annotations.
--
This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. 

==


~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256167
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Mosh Teitelbaum
Munson, Jacob wrote:
 Yes, the GUI updates, in both Firefox and IE.  Setting the value to an
 invalid option is just ignored in Firefox, but in IE the select list is
 set to blank (nothing selected). 

Interesting.  Thanks for the update.

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256170
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Tricky Form validation Question (for me at least)

2006-10-10 Thread Mosh Teitelbaum
Dave Watts wrote:
 Well, strictly speaking, this isn't a JavaScript thing as much as an HTML
 DOM thing. It's up to the DOM to specify what's what in the
 browser. In the case of SELECT fields:

Right... and actually, as I suggested in a subsequent paragraph, the value
property may have been added as part of the browsers' support for the DOM.
I just found a reference to the value property in the DOM Level 1 spec:

http://www.w3.org/TR/2000/WD-DOM-Level-1-2929/level-one-html.html#ID-942
82980

So it would seem that this is now per the standard.  I'd still like to know
(I really should just test this myself and stop asking other to do it 8^)
how the ability to write to this property is implemented.

 If the above URL is correct, it's writeable. Again, though, if I want to
 change an option's value, I just delete and recreate the option using the
 Option constructor.

That's how I've always done it too.  Or just modify the option's value
directly.  But this seems to suggest a new, more direct way of doing it.  Of
course, backwards compatibility could be an issue.

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:256169
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


CF 5 Form validation Question

2006-01-15 Thread Les Mizzell
Argh - trying to dev a CF 5 app on box running MX 7 - and I can't always 
remember what won't work in CF 5!

OK - form validation...


cfinput id=firstName
  name=firstName
  type=text
  required=Yes
  message=You must enter your first name
  maxLength=25 /


According to CF 5 docs, I don't see a darned thing wrong with that. It 
runs fine locally too. When I put it out on the testing server (CF 
version unknown, but probably 6 or something...), the above is IGNORED 
completely and the form submits...

If I do a view-source for the page containing the form, the proper 
javascript seems to have been generated for the page.

Any idea what might be causing this?

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229643
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Form Validation Question

2000-12-08 Thread Jeff Fongemie

This is sort of confusion to explain, but I will try.

I'm attempting to validate a form using the example in MASTERING COLD FUSION
4, pg 390, ex 15.4.

Of course the book example is ultra simple. 3 easy text fields, submits to
another script that validates by checking to see if value is zero. This is
Cold Fusion validation by the way, no Java Script. I would have used, client
side JavaScript but could not get CFSELECT to give the popup using the
simple message attribute. I know there are other ways w/JavaScript but I'm
deep into this way and I think I am close.

So, submit the form and then the next script checks for zero values. If a
zero value is found, a "you messed up" message is generated and the form
field is re-presented to be fixed. All works well, except I'm using a few
textareas. If the textareas do not get filled out on the "fix it page" and
submitted, they are not giving an error since there is some value in there.


!--- Check if an address has been provided ---
CFIF Len(Form.Address) is 0
CFSET Valid = False
CFSET Error = Error  "An Address is required.BR"

CFSET address = "   textarea name=""Address"" rows=""3""
VALUE=""#Form.Address#"" /textarea"  
/CFIF



But, with another Formfield,
!--- Check if a last name has been provided ---
CFIF Len(Form.lastName) is 0
CFSET Valid = False
CFSET Error = Error  "A last Name is required.BR"
CFSET lastName = "INPUT TYPE=TEXT NAME=""lastName"" SIZE=30 MAXLENGTH=50
VALUE=""#Form.lastName#"""
/CFIF

the above can be submited over and over and will trigger the zero value.


What is wrong with my textareas so they make it past my checking for zero
values??

Here is the complete code from the page:



!--- The warform_entryform.cfm sends its info here for checking before
insert into data base.  ---


!--- The following lines through 68 will set each value from the form so if
we need to return any fields back to be fixed, the user does not retype
everything ---

CFSET Valid = True
CFSET Error = ""
CFSET firstname = "#Form.firstname#INPUT TYPE=HIDDEN NAME=""firstname""
VALUE=""#Form.firstName#"""
CFSET lastname = "#Form.lastname#INPUT TYPE=HIDDEN NAME=""lasttname""
VALUE=""#Form.lastName#"""

CFSET address = "#Form.address#INPUT TYPE=HIDDEN NAME=""address""
VALUE=""#Form.address#"""
CFSET age = "#Form.age#INPUT TYPE=HIDDEN NAME=""age""
VALUE=""#Form.age#"""

CFSET city = "#Form.city#INPUT TYPE=HIDDEN NAME=""city""
VALUE=""#Form.city#"""

CFSET StateOrProvince = "#Form.StateOrProvince#INPUT TYPE=HIDDEN
NAME=""StateOrProvince"" VALUE=""#Form.StateOrProvince#"""

CFSET PostalCode = "#Form.PostalCode#INPUT TYPE=HIDDEN NAME=""PostalCode""
VALUE=""#Form.PostalCode#"""
CFSET Country = "#Form.Country#INPUT TYPE=HIDDEN NAME=""Country""
VALUE=""#Form.Country#"""
CFSET EmailAddress = "#Form.EmailAddress#INPUT TYPE=HIDDEN
NAME=""EmailAddress"" VALUE=""#EmailAddress#"""

CFSET HomePhone = "#Form.HomePhone#INPUT TYPE=HIDDEN NAME=""HomePhone""
VALUE=""#HomePhone#"""

CFSET Framemodel = "#Form.Framemodel#INPUT TYPE=HIDDEN NAME=""Framemodel""
VALUE=""#Framemodel#"""

CFSET stockorcustom = "#Form.stockorcustom#INPUT TYPE=HIDDEN
NAME=""stockorcustom"" VALUE=""#stockorcustom#"""

CFSET size = "#Form.size#INPUT TYPE=HIDDEN NAME=""size""
VALUE=""#size#"""

CFSET serial = "#Form.serial#INPUT TYPE=HIDDEN NAME=""serial""
VALUE=""#serial#"""

CFSET dateofpurchase = "#Form.dateofpurchase#INPUT TYPE=HIDDEN
NAME=""dateofpurchase"" VALUE=""#dateofpurchase#"""

CFSET color = "#Form.color#INPUT TYPE=HIDDEN NAME=""color""
VALUE=""#color#"""
CFSET nameofdealer = "#Form.nameofdealer#INPUT TYPE=HIDDEN
NAME=""nameofdealer"" VALUE=""#nameofdealer#"""
CFSET dealerlocation = "#Form.dealerlocation#INPUT TYPE=HIDDEN
NAME=""dealerlocation"" VALUE=""#dealerlocation#"""

CFSET income = "#Form.income#INPUT TYPE=HIDDEN NAME=""income""
VALUE=""#income#"""

CFSET gender = "#Form.gender#INPUT TYPE=HIDDEN NAME=""gender""
VALUE=""#gender#"""
CFSET ride_often = "#Form.ride_often#INPUT TYPE=HIDDEN NAME=""ride_often""
VALUE=""#ride_often#"""

CFSET website_visit = "#Form.website_visit#INPUT TYPE=HIDDEN
NAME=""website_visit"" VALUE=""#website_visit#"""

CFSET ride_often = "#Form.ride_often#INPUT TYPE=HIDDEN NAME=""ride_often""
VALUE=""#ride_often#"""

CFSET motivated_buy = "#Form.motivated_buy#INPUT TYPE=HIDDEN
NAME=""motivated_buy"" VALUE=""#motivated_buy#"""
CFSET dealer_assistance = "#Form.dealer_assistance#INPUT TYPE=HIDDEN
NAME=""dealer_assistance"" VALUE=""#dealer_assistance#"""


CFSET if_contact = "#Form.if_contact#INPUT TYPE=HIDDEN NAME=""if_contact""
VALUE=""#if_contact#"""

CFSET festivals_attend = "#Form.festivals_attend#INPUT TYPE=HIDDEN
NAME=""festivals_attend"" VALUE=""#festivals_attend#"""


CFSET dealer_assistance = "#Form.dealer_assistance#INPUT TYPE=HIDDEN
NAME=""dealer_assistance"" VALUE=""#dealer_assistance#"""



CFSET clubor_team = "#Form.clubor_team#INPUT TYPE=HIDDEN
NAME=""clubor_team"" VALUE=""#clubor_team#"""


CFSET organized_rides = 

RE: Form Validation Question

2000-12-08 Thread John Rice


Use len(trim(form.formfield)).

Textareas, unless in the format textarea/textarea will not be eq "".

If you have, the texarea has a CRLF in it.

textarea
/textarea

the trim() will ignore the CRLF.



This is sort of confusion to explain, but I will try.

I'm attempting to validate a form using the example in MASTERING COLD FUSION
4, pg 390, ex 15.4.

Of course the book example is ultra simple. 3 easy text fields, submits to
another script that validates by checking to see if value is zero. This is
Cold Fusion validation by the way, no Java Script. I would have used, client
side JavaScript but could not get CFSELECT to give the popup using the
simple message attribute. I know there are other ways w/JavaScript but I'm
deep into this way and I think I am close.

So, submit the form and then the next script checks for zero values. If a
zero value is found, a "you messed up" message is generated and the form
field is re-presented to be fixed. All works well, except I'm using a few
textareas. If the textareas do not get filled out on the "fix it page" and
submitted, they are not giving an error since there is some value in there.


!--- Check if an address has been provided ---
CFIF Len(Form.Address) is 0
CFSET Valid = False
CFSET Error = Error  "An Address is required.BR"

CFSET address = "   textarea name=""Address"" rows=""3""
VALUE=""#Form.Address#"" /textarea"  
/CFIF



But, with another Formfield,
!--- Check if a last name has been provided ---
CFIF Len(Form.lastName) is 0
CFSET Valid = False
CFSET Error = Error  "A last Name is required.BR"
CFSET lastName = "INPUT TYPE=TEXT NAME=""lastName"" SIZE=30
MAXLENGTH=50
VALUE=""#Form.lastName#"""
/CFIF

the above can be submited over and over and will trigger the zero value.


What is wrong with my textareas so they make it past my checking for zero
values??

Here is the complete code from the page:



!--- The warform_entryform.cfm sends its info here for checking before
insert into data base.  ---


!--- The following lines through 68 will set each value from the form so if
we need to return any fields back to be fixed, the user does not retype
everything ---

CFSET Valid = True
CFSET Error = ""
CFSET firstname = "#Form.firstname#INPUT TYPE=HIDDEN NAME=""firstname""
VALUE=""#Form.firstName#"""
CFSET lastname = "#Form.lastname#INPUT TYPE=HIDDEN NAME=""lasttname""
VALUE=""#Form.lastName#"""

CFSET address = "#Form.address#INPUT TYPE=HIDDEN NAME=""address""
VALUE=""#Form.address#"""
CFSET age = "#Form.age#INPUT TYPE=HIDDEN NAME=""age""
VALUE=""#Form.age#"""

CFSET city = "#Form.city#INPUT TYPE=HIDDEN NAME=""city""
VALUE=""#Form.city#"""

CFSET StateOrProvince = "#Form.StateOrProvince#INPUT TYPE=HIDDEN
NAME=""StateOrProvince"" VALUE=""#Form.StateOrProvince#"""

CFSET PostalCode = "#Form.PostalCode#INPUT TYPE=HIDDEN NAME=""PostalCode""
VALUE=""#Form.PostalCode#"""
CFSET Country = "#Form.Country#INPUT TYPE=HIDDEN NAME=""Country""
VALUE=""#Form.Country#"""
CFSET EmailAddress = "#Form.EmailAddress#INPUT TYPE=HIDDEN
NAME=""EmailAddress"" VALUE=""#EmailAddress#"""

CFSET HomePhone = "#Form.HomePhone#INPUT TYPE=HIDDEN NAME=""HomePhone""
VALUE=""#HomePhone#"""

CFSET Framemodel = "#Form.Framemodel#INPUT TYPE=HIDDEN NAME=""Framemodel""
VALUE=""#Framemodel#"""

CFSET stockorcustom = "#Form.stockorcustom#INPUT TYPE=HIDDEN
NAME=""stockorcustom"" VALUE=""#stockorcustom#"""

CFSET size = "#Form.size#INPUT TYPE=HIDDEN NAME=""size""
VALUE=""#size#"""

CFSET serial = "#Form.serial#INPUT TYPE=HIDDEN NAME=""serial""
VALUE=""#serial#"""

CFSET dateofpurchase = "#Form.dateofpurchase#INPUT TYPE=HIDDEN
NAME=""dateofpurchase"" VALUE=""#dateofpurchase#"""

CFSET color = "#Form.color#INPUT TYPE=HIDDEN NAME=""color""
VALUE=""#color#"""
CFSET nameofdealer = "#Form.nameofdealer#INPUT TYPE=HIDDEN
NAME=""nameofdealer"" VALUE=""#nameofdealer#"""
CFSET dealerlocation = "#Form.dealerlocation#INPUT TYPE=HIDDEN
NAME=""dealerlocation"" VALUE=""#dealerlocation#"""

CFSET income = "#Form.income#INPUT TYPE=HIDDEN NAME=""income""
VALUE=""#income#"""

CFSET gender = "#Form.gender#INPUT TYPE=HIDDEN NAME=""gender""
VALUE=""#gender#"""
CFSET ride_often = "#Form.ride_often#INPUT TYPE=HIDDEN NAME=""ride_often""
VALUE=""#ride_often#"""

CFSET website_visit = "#Form.website_visit#INPUT TYPE=HIDDEN
NAME=""website_visit"" VALUE=""#website_visit#"""

CFSET ride_often = "#Form.ride_often#INPUT TYPE=HIDDEN NAME=""ride_often""
VALUE=""#ride_often#"""

CFSET motivated_buy = "#Form.motivated_buy#INPUT TYPE=HIDDEN
NAME=""motivated_buy"" VALUE=""#motivated_buy#"""
CFSET dealer_assistance = "#Form.dealer_assistance#INPUT TYPE=HIDDEN
NAME=""dealer_assistance"" VALUE=""#dealer_assistance#"""


CFSET if_contact = "#Form.if_contact#INPUT TYPE=HIDDEN NAME=""if_contact""
VALUE=""#if_contact#"""

CFSET festivals_attend = "#Form.festivals_attend#INPUT TYPE=HIDDEN
NAME=""festivals_attend"" VALUE=""#festivals_attend#"""


CFSET dealer_assistance = 

RE: Form Validation Question

2000-12-08 Thread Patricia Lee

use len(trim(form.lastname))   If the textbox (You did mean textbox, not
text area, yes?  a text block is a single line field that can only accept
255 charachters, while a textarea is multiline and has no max character
restriction) is empty, this combination of functions returns 0 so your
cfif could look like this..

cfif len(trim(form.lastname))  !--- Any number, 1 through whatever, will
trip this part ---
do something
cfelse !--- the number 0 trips this part ---
don't
/cfif


The secret is the trim function. it gets rid of all leading and trailing
zeros... and will make your function return 0 when it should.


 -Original Message-
 From: Jeff Fongemie [mailto:[EMAIL PROTECTED]]
 Sent: Friday, December 08, 2000 10:04 AM
 To: CF-Talk
 Subject: Form Validation Question
 
 
 This is sort of confusion to explain, but I will try.
 
 I'm attempting to validate a form using the example in 
 MASTERING COLD FUSION
 4, pg 390, ex 15.4.
 
 Of course the book example is ultra simple. 3 easy text 
 fields, submits to
 another script that validates by checking to see if value is 
 zero. This is
 Cold Fusion validation by the way, no Java Script. I would 
 have used, client
 side JavaScript but could not get CFSELECT to give the 
 popup using the
 simple message attribute. I know there are other ways 
 w/JavaScript but I'm
 deep into this way and I think I am close.
 
 So, submit the form and then the next script checks for zero 
 values. If a
 zero value is found, a "you messed up" message is generated 
 and the form
 field is re-presented to be fixed. All works well, except I'm 
 using a few
 textareas. If the textareas do not get filled out on the "fix 
 it page" and
 submitted, they are not giving an error since there is some 
 value in there.
 
 
 !--- Check if an address has been provided ---
 CFIF Len(Form.Address) is 0
   CFSET Valid = False
   CFSET Error = Error  "An Address is required.BR"
 
   CFSET address = "   textarea name=""Address"" rows=""3""
 VALUE=""#Form.Address#"" /textarea"  
 /CFIF
 
 
 
 But, with another Formfield,
 !--- Check if a last name has been provided ---
 CFIF Len(Form.lastName) is 0
   CFSET Valid = False
   CFSET Error = Error  "A last Name is required.BR"
   CFSET lastName = "INPUT TYPE=TEXT NAME=""lastName"" 
 SIZE=30 MAXLENGTH=50
 VALUE=""#Form.lastName#"""
 /CFIF
 
 the above can be submited over and over and will trigger the 
 zero value.
 
 
 What is wrong with my textareas so they make it past my 
 checking for zero
 values??
 
 Here is the complete code from the page:
 
 
 
 !--- The warform_entryform.cfm sends its info here for 
 checking before
 insert into data base.  ---
 
 
 !--- The following lines through 68 will set each value from 
 the form so if
 we need to return any fields back to be fixed, the user does 
 not retype
 everything ---
 
 CFSET Valid = True
 CFSET Error = ""
 CFSET firstname = "#Form.firstname#INPUT TYPE=HIDDEN 
 NAME=""firstname""
 VALUE=""#Form.firstName#"""
 CFSET lastname = "#Form.lastname#INPUT TYPE=HIDDEN 
 NAME=""lasttname""
 VALUE=""#Form.lastName#"""
 
 CFSET address = "#Form.address#INPUT TYPE=HIDDEN NAME=""address""
 VALUE=""#Form.address#"""
 CFSET age = "#Form.age#INPUT TYPE=HIDDEN NAME=""age""
 VALUE=""#Form.age#"""
 
 CFSET city = "#Form.city#INPUT TYPE=HIDDEN NAME=""city""
 VALUE=""#Form.city#"""
 
 CFSET StateOrProvince = "#Form.StateOrProvince#INPUT TYPE=HIDDEN
 NAME=""StateOrProvince"" VALUE=""#Form.StateOrProvince#"""
 
 CFSET PostalCode = "#Form.PostalCode#INPUT TYPE=HIDDEN 
 NAME=""PostalCode""
 VALUE=""#Form.PostalCode#"""
 CFSET Country = "#Form.Country#INPUT TYPE=HIDDEN NAME=""Country""
 VALUE=""#Form.Country#"""
 CFSET EmailAddress = "#Form.EmailAddress#INPUT TYPE=HIDDEN
 NAME=""EmailAddress"" VALUE=""#EmailAddress#"""
 
 CFSET HomePhone = "#Form.HomePhone#INPUT TYPE=HIDDEN 
 NAME=""HomePhone""
 VALUE=""#HomePhone#"""
 
 CFSET Framemodel = "#Form.Framemodel#INPUT TYPE=HIDDEN 
 NAME=""Framemodel""
 VALUE=""#Framemodel#"""
 
 CFSET stockorcustom = "#Form.stockorcustom#INPUT TYPE=HIDDEN
 NAME=""stockorcustom"" VALUE=""#stockorcustom#"""
 
 CFSET size = "#Form.size#INPUT TYPE=HIDDEN NAME=""size&

RE: Form Validation Question

2000-12-08 Thread Stolpner, Richard J



Maybe I'm missing the point of your question, but 
if I do understand what you're saying correctly, 
then I think the cause of your problem may be as 
simple as correcting the way you're nesting the 
double quotes in your code.





-Original Message-
From: Patricia Lee [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 08, 2000 11:55 AM
To: CF-Talk
Subject: RE: Form Validation Question


use len(trim(form.lastname))   If the textbox (You did mean textbox, not
text area, yes?  a text block is a single line field that can only accept
255 charachters, while a textarea is multiline and has no max character
restriction) is empty, this combination of functions returns 0 so your
cfif could look like this..

cfif len(trim(form.lastname))  !--- Any number, 1 through whatever, will
trip this part ---
do something
cfelse !--- the number 0 trips this part ---
don't
/cfif


The secret is the trim function. it gets rid of all leading and trailing
zeros... and will make your function return 0 when it should.


 -Original Message-
 From: Jeff Fongemie [mailto:[EMAIL PROTECTED]]
 Sent: Friday, December 08, 2000 10:04 AM
 To: CF-Talk
 Subject: Form Validation Question
 
 
 This is sort of confusion to explain, but I will try.
 
 I'm attempting to validate a form using the example in 
 MASTERING COLD FUSION
 4, pg 390, ex 15.4.
 
 Of course the book example is ultra simple. 3 easy text 
 fields, submits to
 another script that validates by checking to see if value is 
 zero. This is
 Cold Fusion validation by the way, no Java Script. I would 
 have used, client
 side JavaScript but could not get CFSELECT to give the 
 popup using the
 simple message attribute. I know there are other ways 
 w/JavaScript but I'm
 deep into this way and I think I am close.
 
 So, submit the form and then the next script checks for zero 
 values. If a
 zero value is found, a "you messed up" message is generated 
 and the form
 field is re-presented to be fixed. All works well, except I'm 
 using a few
 textareas. If the textareas do not get filled out on the "fix 
 it page" and
 submitted, they are not giving an error since there is some 
 value in there.
 
 
 !--- Check if an address has been provided ---
 CFIF Len(Form.Address) is 0
   CFSET Valid = False
   CFSET Error = Error  "An Address is required.BR"
 
   CFSET address = "   textarea name=""Address"" rows=""3""
 VALUE=""#Form.Address#"" /textarea"  
 /CFIF
 
 
 
 But, with another Formfield,
 !--- Check if a last name has been provided ---
 CFIF Len(Form.lastName) is 0
   CFSET Valid = False
   CFSET Error = Error  "A last Name is required.BR"
   CFSET lastName = "INPUT TYPE=TEXT NAME=""lastName"" 
 SIZE=30 MAXLENGTH=50
 VALUE=""#Form.lastName#"""
 /CFIF
 
 the above can be submited over and over and will trigger the 
 zero value.
 
 
 What is wrong with my textareas so they make it past my 
 checking for zero
 values??
 
 Here is the complete code from the page:
 
 
 
 !--- The warform_entryform.cfm sends its info here for 
 checking before
 insert into data base.  ---
 
 
 !--- The following lines through 68 will set each value from 
 the form so if
 we need to return any fields back to be fixed, the user does 
 not retype
 everything ---
 
 CFSET Valid = True
 CFSET Error = ""
 CFSET firstname = "#Form.firstname#INPUT TYPE=HIDDEN 
 NAME=""firstname""
 VALUE=""#Form.firstName#"""
 CFSET lastname = "#Form.lastname#INPUT TYPE=HIDDEN 
 NAME=""lasttname""
 VALUE=""#Form.lastName#"""
 
 CFSET address = "#Form.address#INPUT TYPE=HIDDEN NAME=""address""
 VALUE=""#Form.address#"""
 CFSET age = "#Form.age#INPUT TYPE=HIDDEN NAME=""age""
 VALUE=""#Form.age#"""
 
 CFSET city = "#Form.city#INPUT TYPE=HIDDEN NAME=""city""
 VALUE=""#Form.city#"""
 
 CFSET StateOrProvince = "#Form.StateOrProvince#INPUT TYPE=HIDDEN
 NAME=""StateOrProvince"" VALUE=""#Form.StateOrProvince#"""
 
 CFSET PostalCode = "#Form.PostalCode#INPUT TYPE=HIDDEN 
 NAME=""PostalCode""
 VALUE=""#Form.PostalCode#"""
 CFSET Country = "#Form.Country#INPUT TYPE=HIDDEN NAME=""Country""
 VALUE=""#Form.Country#"""
 CFSET EmailAddress = "#Form.EmailAddress#INPUT TYPE=HIDDEN
 NAME=""EmailAddress"" VALUE=""#EmailAddress#"""
 
 CFSET HomePhone = "#Form.HomePhone#INPUT TYPE=HIDDEN 
 NAME=""HomePhone""
 VALUE=""#HomePhone#"""