Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form parameters

Status
Not open for further replies.

timmbo

Programmer
Feb 22, 2001
167
US
Hi all,

Trying to pass a Form parameter from onsubmit in IE to a servlet.

<Form Name=&quot;manageFavorties&quot; onSubmit=&quot;InfoReportServlet?action=1&quot;>

In IE, I receive an error wanting a : in place of the question mark. Doesn't : signify a port? Is my syntax for passing a parameter in IE correct? This works great in Netscape.

Any help would be appreciated.

Tim

 
If you are using method=post then send your variable as a hidden input instead of as query string.

<input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;1&quot;>

Hope that helps. Dean Owen
 
Thanks for the reply Dean.

What I am attempting to do is onsubmit, call a servlet with the default parameter action=1.

I tried this:

<Form Name=&quot;manageFavorties&quot; Action=&quot;InfoReportServlet?action=1&quot; Method=&quot;Get&quot;>

It didn't blow up on me. Will this submit the form for me???

As you can probably see, I am very new to this.


Thanks,
Tim
 
Hard to tell. Try it and see. If it works, great. But the easiest way to pass a param via a form is the hidden input method.

Good luck.

Dean. Dean Owen
 
If you have other values on the form that you also want to pass to the servlet, you'll need to use POST and the hidden field method. It's not a good idea to mix POST and GET, and most form submissions use POST.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
A form won't submit itself, if you want it to auto-submit, add the following into the body tag of the page:
Code:
<body onload=&quot;javascript:document.forms['manageFavorties'].submit();&quot;>

-Scott
 
Thanks for the help everyone. The suggestions are great.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top