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 }

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

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

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

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) {

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.

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

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

2006-10-10 Thread Ben Nadel
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

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

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

2006-10-10 Thread Ben Nadel
. 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

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

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

2006-10-10 Thread Ben Nadel
. .. 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

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

2006-10-10 Thread Charlie Griefer
. .. 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

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

2006-10-10 Thread Bobby Hartsfield
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

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

2006-10-10 Thread Bobby Hartsfield
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

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

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

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:

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

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

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:

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