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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One form, multiple submits

Status
Not open for further replies.

shadow02

Programmer
Apr 12, 2004
14
Ok, in my efforts to use the posts on here to solve my problem, I have gone mad and have resorted to a post. I am very good at VB and getting good at VB script but my first attempt at using javascript is, well, yeah you know.

Basically I am trying to have multiple search buttons on one page and each button will force a submit. Now have played around with the code and managed to get rid of the errors, the code actually does work. Each button will go to a different form. Yet when I use the Request(string) in my vbscript, nothing happens. Why because the URL does not have the data like a normal submit.

So what am I missing. Obviously something has to add the data to the URL.

<SCRIPT LANGUAGE="JavaScript">
function fncDepartment()
{
// alter the action and submit the form
document.Form1.action = "search_result_dep.asp";
document.Form1.submit();

}

function fncTitle()
{
// alter the action and submit the form
document.Form1.action = "search_result_title.asp";
document.Form1.submit();
}
</SCRIPT>


<FORM NAME="Form1">
<input type="submit" value="Show" ONCLICK="fncDepartment();"><BR>
<input type="submit" value="Show" ONCLICK="fncTitle();"><BR>
</FORM>

I would appreciate anyones help on this.
Shadow
 

Try adding a method attribute to your form:

Code:
<form name="Form1" method="get">

And if that fails, try the post method:

Code:
<form name="Form1" method="post">

Hope this helps,
Dan
 
Thanks Dan, the method attribute works when I only have the one submit, the java code is designed to do the same thing just dependant on which button is pressed. The attribute wont work in the java code, well I tried and it did not work. Cause it is HTML.

What I need is a method function to fire in the javascript. I actually did try adding.

document.Form1.method = "Get"

There was no error so the syntax must be correct but again same problem with no data going to the next page.

Any other suggestions?
Thanks
Shadow
 
I worked out my problem with this. I am new to Forms in ASP so now I understand that if your are referencing the ofmr make sure what you POST or GET is within the form area. Basically <FORM NAME="Form1" method="POST"> was beloe the drop down box, hence it was not being posted.

Either way I worked out another way to do the same thing. So now I know two.
Thanks
Shadow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top