I played with both of those tags a while back and didn't really like them. I
was probably doing something wrong though. I decided to just write my own,
it was a lot easier than figuring out those tags... :)  Unfortunately this
does not work in NS4 (works in IE4+, NS6). It's probably something easy, but
I haven't gotten a chance to look at it yet.

Here is the code.

<cfquery datasource="#dsn#" name="getRegions">
SELECT State, Region
FROM Locations
</cfquery>

<script language="JavaScript">
//sets up javascript array with the two related query columns. State/Regions
in my case.
 regions = new Array();
 <cfset counter = 0>
 <cfoutput query="getRegions">
   #state# = new Array();
   #state#[0] = '#region#';
   #state#[1] = '#state#';
   regions[#counter#] = #state#;
  <cfset counter = counter + 1></cfoutput>

//When the select is changed, this loops through the array and looks for the
selected state.
//If a match is found it is appended to the regions select box.

function getRegion(elem) {
 //this line resets the select box, but leaves the first option.
 document.entry.region.options.length = 1;
  for (i = 0; i != regions.length; i++) {
   if (regions[i][1] == elem.value) {
    var o = new Option(regions[i][0], regions[i][0], false, false);
    document.forms[0].region.options[document.entry.region.length] = o;
   }
  }
 }
</script>

<form name="entry" method="post">
    <select name="state" size="1" class="reginput"
onchange="getRegion(this);">
        <cf_state value="full" selected="#state#">
    </select>

    <select name="region" size="1" style="width:150px">
            <option value="">Entire State</option>
    </select>
</form>

jon
----- Original Message -----
From: "Steven Dworman" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, September 24, 2001 10:27 AM
Subject: twoselectsrelated


> I've been playing with twoselectsrelated, and for some reason I'm running
> into a bind.  I have a multipart form where I'm storing the data using the
> following methodology.  I take the data and throw it into an array
> and store the array in a structure and then finally keep it in a WDDX
> packet.  The problem I'm having with the tag is when I want to go back and
> update data.  I am using it to populate a select box of
> countries and upon a selection a select box of states/provinces will
appear
> (which is what the tag is intended to do).  When I attempt to update the
> data, the country select box has the selected value selected,
> however, the state/province select box is empty.  I've updated the tag to
> accept default values, using the same code from threeselectsrelated.  Any
> suggestions?
>
>
>
>
> Steven D Dworman
> -------------------------------------------------------------------------
> Web Consultant
> Systems Administrator
>
> ComSpec International - http://www.comspec-intnl.com
> phone: 248.647.8841
> cell:  734.972.9676
> -------------------------------------------------------------------------
> EMPOWER-XL ***Software for Higher Education***
> http://www.empower-xl.com
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to