RE: Another JavaScript form submit question

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

 Date:  Thu, 8 Jun 2000 15:43:00 -0500
 To:  "'Cyanide _7'" <leo7278(at)hotmail.com>
 Cc:  <hwg-languages(at)hwg.org>
 In-Reply-To:  hotmail
  todo: View Thread, Original
Well, Cyanide_7 pointed me in the right direction. It wasn't a typo exactly
but this particular form is intolerant of slight variations in structure
I've gotten away with elsewhere. Here is a version closer to the real web
page (I had assumed my problem was near the beginning of the form). See the
name attributes in the Submit and Reset buttons? Bad, bad, bad. Took 'em
out; now it works!

Keith Purtell, Web Designer


<FORM name="myform" action="process_form.html" method="POST">
<SELECT name="OptionNumber" size="1" onChange="this.form.submit();">
	<OPTION selected value="1">First</OPTION>
	<OPTION value="2">Second</OPTION>
	<OPTION value="3">Third</OPTION>
</SELECT>
<INPUT type="submit" name="submit" value="Submit">
<INPUT type="reset" name="reset" value="Reset">
</FORM>


> -----Original Message-----
> From: Cyanide _7 [mailto:leo7278(at)hotmail.com]
> Sent: Thursday, June 08, 2000 12:16 PM
> To: kpurtell(at)vantagemed.net
> Cc: hwg-languages(at)hwg.org
> Subject: RE: Another JavaScript form submit question
>
>
> well i tested it again, and it still works fine for me IE5. and this
> technique is not exclusive to either browser and should work in V3.x+
> browsers i think. whats the URL of the page in question?
> Maybe there's some
> other code conflicting or a typo even. - Cyanide_7
>
> >
> >My intention is user convenience. The form in question is a
> heavily-used
> >page where administrators pick an office location from the
> drop down, then
> >click "Submit" to go to a ColdFusion template where a
> database query lists
> >all employees at that location. That's basically all the
> page does: select
> >a
> >location. I thought making the submit automatic would cut
> their time in
> >half; a little tweak for my users. By the way, I tried your
> suggestion and
> >got the same error message. I thought some other code on the
> page might be
> >interfering, so I stripped out everything except the minimum
> HTML, the form
> >and the onChange. No luck. Stranger yet, it says my
> JavaScript error is on
> >line 37, which does not exist now that I stripped down the
> document. I'm
> >using IE5 on Win98. A test with Netscape 4.7 resulted in
> "JavaScript Error:
> >this.form.submit is not a function" Hey, this was supposed
> to be simple!
> >
> >Keith Purtell, Web Designer
> >
> > > -----Original Message-----
> > > From: Cyanide _7 [mailto:leo7278(at)hotmail.com]
> > > Sent: Wednesday, June 07, 2000 6:59 PM
> > > To: kpurtell(at)vantagemed.net
> > > Cc: hwg-languages(at)hwg.org
> > > Subject: Re: Another JavaScript form submit question
> > >
> > >
> > > im not quite sure what you mean or why you want to do this,
> > > but this should
> > > do it:
> > >
> > > <FORM name="myform" action="process_form.html" method="POST">
> > > <SELECT name="OptionNumber" size="1"
> onChange="this.form.submit();">
> > >   <OPTION selected value="1">First</OPTION>
> > >   <OPTION value="2">Second</OPTION>
> > >   <OPTION value="3">Third</OPTION>
> > > </SELECT>
> > > </FORM>
> > >
> > > - Cyanide_7
> > >
> > >
> > > >This is a variation on the last question you folks
> answered, where
> > > >selecting
> > > >an option from a drop-down menu submitted a form, and
> the submission
> > > >location was contained in the option value.
> > > >
> > > >This time, I'm trying to submit to the location specified
> > > with ACTION, and
> > > >selecting from a drop-down menu just initiates the
> > > submission. My attempt
> > > >below tries to work but can't seem to process the target
> URL (path).
> > > >Numerous variations have failed ("Object doesn't support
> > > this property or
> > > >method"). I would really appreciate a bug fix! Thank you.
> > > >
> > > ><SCRIPT LANGUAGE="JavaScript">
> > > >function SendTo_Page(object) {
> > > >	var path = "process_form.html";
> > > >	window.location.replace(path);
> > > >	document.myform.submit();
> > > >}
> > > ></SCRIPT>
> > > >
> > > ><FORM name="myform" action="process_form.html" method="POST">
> > > >	<SELECT name="OptionNumber" size="1"
> > > onChange="SendTo_Page(this)">
> > > >	<OPTION selected value="1">First</OPTION>
> > > >	<OPTION value="2">Second</OPTION>
> > > >	<OPTION value="3">Third</OPTION>
> > > >	</SELECT>

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