OK...
I'm sorry that I haven't given you all of the information that you need.
select.selectedIndex is a method that can read(==) or write(=) the
indexed that is selected by a select box. The index starts at 0 for the
first option. When you used pobox.selectedIndex=3, that was a
non-existant option and so it created a blank option for you.
Try the below code.
- Matt Small
<select name="pobox" onchange="if (pobox.selectedIndex== 2)
shippingmethod.selectedIndex = 2;" class="formfield">
<option value="">
<option value="0" <cfif client.pobox eq 0>selected</cfif>>No
<option value="1" <cfif client.pobox eq 1>selected</cfif>>Yes
</select>
<select name="shippingmethod"
onChange="usps();calculate(this.form);updateshipping();checkpobox();" >
<option value="">Select Shipping Method
<option value="#variables.UPS#"<cfif client.shippingmethod is
"#variables.UPS#" >selected</cfif>>UPS Standard
<option value="#variables.UPS2DAY#" <cfif client.shippingmethod
is "#variables.UPS2DAY#">selected</cfif>>UPS 2 DAY
<option value="#variables.USPS#" <cfif client.shippingmethod is
"#variables.USPS#">selected</cfif>>US Postal Mail </select>
-----Original Message-----
From: Houk, Gary [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 3:04 PM
To: CF-Talk
Subject: RE: OT - JS Select Menu...
Here it is:
<select name="pobox" onchange="if (pobox.selectedIndex= 3)
shippingmethod.selectedIndex = 3;" class="formfield">
<option value="">
<option value="0" <cfif client.pobox eq 0>selected</cfif>>No
<option value="1" <cfif client.pobox eq 1>selected</cfif>>Yes
</select>
<select name="shippingmethod"
onChange="usps();calculate(this.form);updateshipping();checkpobox();" >
<option value="">Select Shipping Method
<option value="#variables.UPS#"<cfif client.shippingmethod is
"#variables.UPS#" >selected</cfif>>UPS Standard
<option value="#variables.UPS2DAY#" <cfif client.shippingmethod
is "#variables.UPS2DAY#">selected</cfif>>UPS 2 DAY
<option value="#variables.USPS#" <cfif client.shippingmethod is
"#variables.USPS#">selected</cfif>>US Postal Mail
</select>
-----Original Message-----
From: Matthew R. Small [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 3:05 PM
To: CF-Talk
Subject: RE: OT - JS Select Menu...
OK... let's see the whole thing that you have
-----Original Message-----
From: Houk, Gary [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 2:53 PM
To: CF-Talk
Subject: RE: OT - JS Select Menu...
Ok, this is weird. I tried the == and it didn't work at all. I tried ==
on each field individually and then together and it would't change. As
soon as I switched it back to a single = , it worked again but still no
selection in the pobox select field...strange...
- Gary
-----Original Message-----
From: Matthew R. Small [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 2:53 PM
To: CF-Talk
Subject: RE: OT - JS Select Menu...
Oh... try
pobox.selectedIndex == 3
Notice the double equal signs.
- Matt
-----Original Message-----
From: Houk, Gary [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 2:37 PM
To: CF-Talk
Subject: RE: OT - JS Select Menu...
Hey Matt,
Ok, it almost works...When I select pobox to be 1 (yes), the shipping
method changes perfectly. Only one problem...the pobox value disappears!
I can still see the dropdown options, but everytime I select one, it
just displays a blank option. Any ideas?
- Gary
<select name="pobox" onchange="if (pobox.selectedIndex= 3)
shippingmethod.selectedIndex = 3;" class="formfield">
-----Original Message-----
From: Matthew R. Small [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 1:49 PM
To: CF-Talk
Subject: RE: OT - JS Select Menu...
Sorry...
<select name="pobox" onchange="if (pobox.selectedIndex== XXX )
shippingmethod.selectedIndex = YYY;">
where I have XXX you need to replace it with the numbered index that the
value of 1 is in your pobox select box. Where I have YYY you need to
replace it with the numbered index that the value of 11.95 is in your
shippingmethod select box.
-----Original Message-----
From: Houk, Gary [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 1:33 PM
To: CF-Talk
Subject: RE: OT - JS Select Menu...
Hi Matt,
I just tried this, but it's still asking for ")" ...any thoughts?
<select name="pobox" onchange="if (pobox.selectedIndex==(index of 1))
shippingmethod.selectedIndex = (index of 11.95);">
-----Original Message-----
From: Matthew R. Small [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 1:28 PM
To: CF-Talk
Subject: RE: OT - JS Select Menu...
Hi Gary,
<select name="pobox" onchange="if (pobox.selectedIndex==(index
of 1) shipbox.selectedIndex = (index of 11.95);">
Matt Small
-----Original Message-----
From: Houk, Gary [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 12:28 PM
To: CF-Talk
Subject: OT - JS Select Menu...
I have two select menus, one is for pobox and one for shipping method. I
want to automatically select the shipping method usps (value of that
option is 11.95) when a user selects pobox (value of 1). I could get it
to update a regular text box, but not a select menu. Any help/code would
be great.
TIA,
- Gary
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists