> I have a form that contains fields for both General Contact Info
> and Billing
> Contact Info.  After the user fills in their General Contact
> Info, they can
> click a checkbox called "Same Billing Info" which Prepopulates all of the
> billing fields w/ the associated General Contact Fields.
>
> It works great except for the "state" field which is a drop down that's
> populated like this:
>
> <CFSELECT NAME="General_State"
>    REQUIRED="yes"
>    SELECTED="#state#"
>    MESSAGE="Please select your State."
>    QUERY="application.qryState"
>    VALUE="st_abbr">
> </CFSELECT>
>
> My javascript is this:
> function handleClick(){
>    with (document.myForm){
>       Billing_Name_First.value = General_Name_First.value
>       Billing_Name_Last.value  = General_Name_Last.value
>         Billing_Address.value = General_Address.value
>         Billing_City.value = General_City.value
>         Billing_State.value = General_State.value
>         Billing_Zip.value = General_Zip.value
>    }
> }
>
> Again, all but Billing_State populate with the General Contact
> Info when the
> checkbox gets checked. Any suggestions on how to get the
> Billing_State field
> to work as well would be greatly appreciated.

As long as they're populated from the same query, then it's (relatively)
easy;

document.myForm.elements["Billing_State"].selectedIndex=document.myForm.elem
ents["General_State"].selectedIndex;

I tend to use elements[] as a rule, but it could be done as

document.myForm.Billing_State.selectedIndex=document.myForm.General_State.se
lectedIndex;

I haven't tested this, but I'm pretty sure it'll work

Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133

"Websites for the real world"

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************


> -----Original Message-----
> From: Jeanne Sarfaty Glazer [mailto:[EMAIL PROTECTED]]
> Sent: 20 February 2001 22:33
> To: CF-Talk
> Subject: CF and Javascript Form Question
>
>
> Hi Everyone,
>
>
> TIA,
> - - - Jeanne S. Glazer
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to