macromedia.coldfusion.advanced_techniques
[Top] [All Lists]

Re: Change state form based on country selected

Subject: Re: Change state form based on country selected
From: chichibish <chadstander@xxxxxxxxx>
Date: Mon, 28 Jul 2008 08:43:45 -0700 (PDT)
Newsgroups: macromedia.coldfusion.advanced_techniques

On Jul 28, 8:56 am, "MarkWright" <webforumsu...@xxxxxxxxxxxxxx> wrote:
> I use DW CS3 with CF8.
>  I have a country form on a shipping page.  If the country is USA, I want to
> make the state form a select box that outputs a query named "qryStateList" 
> that
> list all the states in the USA.  If the country is NOT USA, I want the state
> form to be a text box where the user can type in the value for the state.  Can
> anybody help me with this javascript or can show me a discussion on this
> already?

Try this:
Add a blank span tag or div and give it an id.

Fire this on the onChange event in the select tag:

if(document.forms[x].fieldName.selectedIndex == x)
  newitem = "<input type='text' ..... />";

document.getElementById('span or div id').innerHTML=newitem;

You will have to write some custom validation or find a pre-packaged
solution.  I prefer to use tmt validator myself at massimocorner.com.

-Chad

<Prev in Thread] Current Thread [Next in Thread>