I'm assuming f is your form name.

Firefox uses document.f to reference the form, instead of just the form
name.  I believe this is one of many things IE does that doesn't conform
to standards.

If I were you I'd use this.form instead, since it'll always reference
the right object when called from an input tag within the form.

Joe

-----Original Message-----
From: Damien McKenna [mailto:[EMAIL PROTECTED]
Sent: Friday, September 10, 2004 10:09 AM
To: CF-Talk
Subject: OT: JS checkboxes

OT again.

I'm attempting to write a small bit of JS code to ensure that if a
checkbox is selected that a) another checkbox is deselected and b) an
alert is displayed, and then when the form is submitted it will also
verify

<script language="_javascript_1.2" type="text/_javascript_">
function myValidate(f)
{
if(f.checkbox.LCQ_SIGNUP.checked || f.checkbox.LCQ3MO_SIGNUP.checked)
{
if(!f.SHIP_DATE.checked)
{
alert("You must also select a shipment date!");
f.SHIP_DATE.focus();
return false;
}
}
return true;
}
function mySelect(f)
{
if(f.SIGNUP.checked || f. SIGNUP3MO.checked)
{
if(f.SIGNUP.checked)
f.SIGNUP3MO.checked = false;
else
f.SIGNUP.checked = false;
alert("Please also select a shipment date");
f.SHIP_DATE.focus();
}
}
</script>

<input type="checkbox" name="SIGNUP" id="SIGNUP"
mySelect(f);" />
<input type="checkbox" name="SIGNUP3MO" id="SIGNUP3MO"
mySelect(f);" />

<input type="radio" name="SHIP_DATE" id="SHIP_DATE" value="1" />
<input type="radio" name="SHIP_DATE" id="SHIP_DATE" value="10" />
<input type="radio" name="SHIP_DATE" id="SHIP_DATE" value="20" />

<input type="submit" name="submit" id="submit" value="Sign up"
/>

Currently when I click a checkbox I get the error "f.SIGNUP has no
properties" in Firefox's _javascript_ console.  I haven't tried the
validation yet as I can't get the first one working.

Any suggestions as to what I'm doing wrong?

Thanks.
--
Damien McKenna - Web Developer - [EMAIL PROTECTED]
The Limu Company - http://www.thelimucompany.com/ - 407-804-1014
"Nothing endures but change." - Heraclitus

  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to