Thanks,
This looks like it will work for me!
Dave
----- Original Message -----
From: "Douglas Brown" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Saturday, July 13, 2002 11:14 AM
Subject: Re: Avoiding another trip to the database
> Here is one I use, maybe you can gain some insight into it....
>
> <SCRIPT LANGUAGE="javascript">
> <!--
> <CFOUTPUT>
> var NEW_ADDRESS_INDEX = #get_cust_shipping_info.recordCount# + 1;
> </CFOUTPUT>
>
> var cust_shipping = new Array()
> <cfoutput query="get_cust_shipping_info">
> cust_shipping[#currentrow#] = new
>
cust_ship_obj("#custNum#","#id#","#loc_desc#","#f_name#","#l_name#","#addres
s_
>
1#","#city#","#state#","#zip_code#","#phone_1#","#ext_1#","#email#","#isDefa
ul
> t#");
> </cfoutput>
> <CFOUTPUT>
> cust_shipping[NEW_ADDRESS_INDEX] = new
>
cust_ship_obj("#get_cust_shipping_info.custNum#","","","","","","","","","",
""
> ,"","");
> </CFOUTPUT>
>
>
> function
>
cust_ship_obj(custNum,id,loc_desc,f_name,l_name,address_1,city,state,zip_cod
e,
> phone_1,ext_1,email,isDefault){
> this.custNum = custNum;
> this.id = id;
> this.loc_desc = loc_desc;
> this.f_name = f_name;
> this.l_name = l_name;
> this.address_1 = address_1;
> this.city = city;
> this.state = state;
> this.zip_code = zip_code;
> this.phone_1 = phone_1;
> this.ext_1 = ext_1;
> this.email = email;
> this.isDefault = isDefault;
> }
>
> function get_cust_info(id){
> var selected_address =
> document.forms[0].choose[document.forms[0].choose.selectedIndex].value;
> if ( ( selected_address == "new" ) ||
> ( selected_address == "none" ) )
> var i = NEW_ADDRESS_INDEX;
> else{
> for (var i = 1; i <= cust_shipping.length - 1; i++) {
> if (cust_shipping[i].id == selected_address) {
> break;
> }
> }
> }
> document.forms[0].id.value = cust_shipping[i].id;
> document.forms[0].loc_desc.value = cust_shipping[i].loc_desc;
> document.forms[0].f_name.value = cust_shipping[i].f_name;
> document.forms[0].l_name.value = cust_shipping[i].l_name;
> document.forms[0].address_1.value = cust_shipping[i].address_1;
> document.forms[0].city.value = cust_shipping[i].city;
> document.forms[0].state.value = cust_shipping[i].state;
> document.forms[0].zip_code.value = cust_shipping[i].zip_code;
> document.forms[0].phone_1.value = cust_shipping[i].phone_1;
> document.forms[0].ext_1.value = cust_shipping[i].ext_1;
> document.forms[0].email.value = cust_shipping[i].email;
> }
> </script>
>
>
>
>
> Douglas Brown
> Email: [EMAIL PROTECTED]
> ----- Original Message -----
> From: "David Fafard" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Saturday, July 13, 2002 5:53 AM
> Subject: Avoiding another trip to the database
>
>
> > Hello,
> >
> > I'm new to CF and trying to figure this out.
> >
> > I have a dynamic select on a form where a user can choose
> > an address type. ie. default, ship to, bill to.. etc. based on
> > a query to the address table.
> >
> > When the user selects an address type, I would like to populate
> > street, city, st and zip form input values from the address table based
> > on the users selection BUT I don't want to reload the form.
> >
> > Is this possible using javascript with the query array? I think it
should
> > be but I'm stumped.
> >
> >
> > Thanks,
> > Dave Fafard
> >
> >
> >
> >
> >
>
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.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