RE: JavaScript submit on select from dropdown

by Keith Purtell <kpurtell(at)vantagemed.net>

 Date:  Mon, 15 May 2000 14:14:20 -0500
 To:  <hwg-languages(at)hwg.org>
  todo: View Thread, Original
Leo:

I wasn't sure I understood your answer, since I couldn't get it to work. I
tried adapting code from the previous example but that didn't help either.
This should be simple but it just sits there when I select an item from the
drop-down. Here's the latest ...

<SCRIPT LANGUAGE="JavaScript">
function SendTo_Template(object) {
    form.submit() = object.options[object.selectedIndex].value;
}
</SCRIPT>
</HEAD><BODY bgcolor="#FFFFFF">

<FORM>
<SELECT size="1" NAME="ProductNumber"
onChange="SendTo_Template(this.form.ProductNumber)">
<OPTION value=""> </OPTION>
<OPTION value="page1.cfm">Target Page One</OPTION>
<OPTION value="page2.cfm">Target Page Two</OPTION>
</SELECT>
</FORM>

Keith Purtell, Web Designer
VantageMed Corporation

> -----Original Message-----
> From: Cyanide _7 [mailto:leo7278(at)hotmail.com]
> Sent: Saturday, May 13, 2000 7:26 PM
> To: kpurtell(at)tiw.net
> Cc: hwg-languages(at)hwg.org
> Subject: Re: JavaScript submit on select from dropdown
>
>
> <SELECT size="1" NAME="ProductNumber"
> onChange="this.form.submit();">
> <OPTION value=""> </OPTION>
> <OPTION value="page1.cfm">FormProcessOne</OPTION>
> <OPTION value="page2.cfm">FormProcessTwo</OPTION>
> </SELECT>
>
> - Cyanide_7
>
>
> >I have a form with a dropdown menu. I want the form to
> submit when the user
> >selects an option on the menu. Here's a script that merely
> takes it to
> >another
> >page; perhaps it can be adapted to submit the form instead?
> >
> ><SCRIPT LANGUAGE="JavaScript">
> >function goto_URL(object) {
> >     window.location.href =
> object.options[object.selectedIndex].value;
> >}
> ></SCRIPT>
> >
> ><SELECT size="1" NAME="ProductNumber"
> >onChange="goto_URL(this.form.ProductNumber)">
> ><OPTION value=""> </OPTION>
> ><OPTION value="page1.cfm">FormProcessOne</OPTION>
> ><OPTION value="page2.cfm">FormProcessTwo</OPTION>
> ></SELECT>
> >

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA