Hi Bec,

This works for me:

It gives me a pulldoen of the "lastname, firstname" of the person.

When a name is selected it auto fills in the "email address" from the
database into the TO: field of the form.

The pulldown is right above the input field but they could be in seperate
places on the page. It uses a javascript "document.formname.fieldname.value"
to locate the field it needs to fill in.


<CFQUERY NAME="GetAddress" DATASOURCE="dbSasak">
 Select * FROM dbCEAddressBook ORDER BY lastname, firstname
</CFQUERY>

--snip--

<CFOUTPUT>
<TABLE BORDER="0" CELLPADDING="4" CELLSPACING="2" WIDTH=100%>
<form method="post" name="frmEmail" action="send.cfm?uid=#uid#">

--snip--

<TR><TD BGCOLOR=#MessageBarColor#><FONT Face=#BodyTextFace#
SIZE=#BodyTextSize# COLOR=##FFFFFF><B>To:</B></FONT>
</TD>
<TD BGCOLOR=#ScreenColor# ALIGN="LEFT">
</CFOUTPUT>

<SELECT NAME="address" onChange="if(options[selectedIndex].value)
document.frmEmail.emailto.value=(options[selectedIndex].value)">
<CFOUTPUT QUERY="getaddress">
<option value="#emailaddress#"> #LastName#, #FirstName#</option>
</CFOUTPUT>
</SELECT>

<CFOUTPUT>
<BR><input type="Text" name="emailto" value="" size="55">
</TD></TR>

--snip--

<TR><TD BGCOLOR=#ScreenColor# COLSPAN="2">
<input type="submit" name="submit" value="Send">
</TD></TR>
</form>

</TABLE>
</CFOUTPUT>

Let me know if you have any questions.

Michael


----------
>From: "Jones, Becky" <[EMAIL PROTECTED]>
>To: CF-Talk <[EMAIL PROTECTED]>
>Subject: FW: adding records
>Date: Thu, Apr 5, 2001, 3:11 PM
>

>
> hey again,
> i have a form which allows a user to add a new application to my apps
> database.
> i want to have a drop down list of companies. (that i can do) but i want the
> phone number field to automatically populate if when the user selects say
> "microsoft" from the list. that phone number will show up in the phone
> number field because "microsoft" has a phone number in my database.
> otherwise, the person inputting the data will have to retype the phone
> number in each time (and remember the number in order to input it!)
> is this possible to do on the same form?
> thanks for the info..
> b
>
>
> *************************************************
> This e-mail, including any attachments, is intended for the
> receipt and use by the intended addressee(s), and may contain
> confidential and privileged information.  If you are not an intended
> recipient of this e-mail, you are hereby notified that any unauthorized
> use or distribution of this e-mail is strictly prohibited.
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to