RE: JavaScript submit on select from dropdown

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

 Date:  Mon, 15 May 2000 18:02:24 -0500
 To:  "'Eric V. Myer'" <evmyer(at)matrixpc.com>,
<hwg-languages(at)hwg.org>
 In-Reply-To:  lsfi
  todo: View Thread, Original
That's creating errors like " 'Form' is not defined "   I tried a variety of
fixes, but it's a stubborn bug.

Keith Purtell, Web Designer


> -----Original Message-----
> From: Eric V. Myer [mailto:evmyer(at)matrixpc.com]
> Sent: Monday, May 15, 2000 3:32 PM
> To: Keith Purtell; hwg-languages(at)hwg.org
> Subject: Re: JavaScript submit on select from dropdown
>
>
> I think you need to set the action property of the form, then call the
> submit method. Like this.
>
> function SendTo_Template(object) {
>     form.action = object.options[object.selectedIndex].value;
>     form.submit();
> }
>
> Eric
>
> > 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