I am not able to make this work..
<html>
<head>
<script language="JavaScript">
        function populate()
           {
           var i = document.myform.code.selectedindex;
           var url_add = document.myform.code.options[i].value;
           window.location.href= url_add;
           }
</script>
</head>
<body>
<cfquery name="get_code" datasource="#datasource#">
    SELECT DISTINCT city_code
    FROM Listing
</cfquery>

<cfif isDefined("url.code")>
<cfquery name="findvalues" datasource="#datasource#" maxrows="1">
     SELECT *
    FROM Listing
    WHERE city_code = '#url.code#'
</cfquery>
  <cfset city_value="#findvalues.city#">
  <cfset state_value="#findvalues.state#">
<cfelse>
  <cfset city_value="">
  <cfset state_value="">
</cfif>

<cfform name="myform" action="Update_Add.cfm?Add">
<table align="center">
<tr>
   <td align="center" class="HeadRed" colspan="8">Input Form</td>
</tr>

<tr>
<td class="label_2" align="right">CITY CODE:</td>
<td align="left"><select name="code" id="code" class="aselect" onchange="populate();">
  <option value="-1" selected>Select one</option>
  <cfoutput query="get_code">
                                                                            <option 
value="#city_code#">#city_code#</option>
  </cfoutput>
</select>
</td>

<td align="right" class="label_2">CITY:</td>
<td align="left"><cfinput type="Text" name="city" value="#city_value#" class="inputbox">
<td align="right" class="label_2">STATE:</td>
<td align="left"><cfinput type="Text" name="state" size="5" value="#state_value#" class="inputbox"></td>
</tr>
</table>
</cfform>
</body>
</html

From: Joe Kelly <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: onChange=populate()
Date: Mon, 11 Jul 2005 09:47:13 -0500

Laila,
Go to the archives.  It's all there.
http://www.mail-archive.com/list%40dfwcfug.org/
I guess we should put a link to this on our new site sometime (hint).
Actually, you can find it on our old site
http://old.dfwcfug.org
which you can link from our current site by going to Member Subscribe.
Thanks,
Joe Kelly

On 7/10/05, Laila Oommen <[EMAIL PROTECTED]> wrote:
> Some of you sent some good suggestions for my request..I was gone on
> vacation..and somehow lost them...Can you plea....ase resend it?
>
> Laila
>
> >--- Laila Oommen <[EMAIL PROTECTED]> wrote:
> >
> > > Has any one got a script to make this work?
> > >
> > > When the code is selected (using a dropdown selection box), I want the
> >city and the
> > > state to be populated
> > > with values from database.
> > >
> > >
> > > <script language="javascript">
> > >       function populate()
> > > </script>
> > >
> > >    <tr>
> > >       <td>CODE</td>
> > >       <td colspan="2">
> > >         <select name="code" onChange=populate()>
> > >           <option selected>Select one</option>
> > >            <cfquery name="getvalues">
> > >               SELECT DISTINCT code
> > >               FROM tblRegion
> > >            </cfquery>
> > >           <cfoutput query="code">
> > >           <option value="">#code#</option>
> > >           </cfoutput>
> > >         </select>
> > >       </td>
> > >     </tr>
> > >     <tr>
> > >         <td>CITY</td>
> > >         <td><input type="text" name="city"></td>
> > >     </tr>
> > >     <tr>
> > >         <td>STATE</td>
> > >         <td><input type="text" name="state"></td>
> > >     </tr>
> > >
> > > Thanks
> > >
> > > Laila
> > >
>
>
> ----------------------------------------------------------
> To post, send email to [email protected]
> To unsubscribe:
>    http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe:
>    http://www.dfwcfug.org/form_MemberRegistration.cfm
>
>
>


--
Thanks,
Joe Kelly
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe:
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe:
   http://www.dfwcfug.org/form_MemberRegistration.cfm




----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: http://www.dfwcfug.org/form_MemberUnsubscribe.cfm To subscribe: http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to