Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

One Page with 3 form submits?

Posted on 2007-11-30
10
161 Views
Last Modified: 2010-04-21
I'm trying to create a pure html page that will take an input value (entered by the user) and then, upon a Button click, pass the value to an ASPX.net page on the query line. I need this ability to appear three times on the same html page and pass to three different ASPX.net pages. Like this

<input id="txtAA" type="text" /><input id="btnAA" type="button" value="Sendto-AA" /><br />
<input id="txtBB" type="text" /><input id="btnBB" type="button" value="Sendto-BB" /><br />
<input id="txtCC" type="text" /><input id="btnCC" type="button" value="Sendto-CC" /><br />

When btnAA is clicked, it takes whatever value was entered in txtAA and passes it, on the query line, to http://mysite.com/AA.aspx
When btnBB is clicked, it takes whatever value was entered in txtBB and passes it, on the query line, to http://mysite.com/BB.aspx
When btnCC is clicked, it takes whatever value was entered in txtCC and passes it, on the query line, to http://mysite.com/CC.aspx

Can anyone help?
0
Comment
Question by:volking
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 11

Expert Comment

by:cmhunty
ID: 20385623
Why does it have to be a button? Can you not use a normal hyperlink? When the textbox changes, you can fire a javascript function which appends the query string to the end of the URL in the link?
0
 
LVL 5

Author Comment

by:volking
ID: 20385660
Isn't a button the standard way to let a user know the field you just typed will be used by the button.

Where a hyperlink doesn't LOOK like it's submitting anything.

I guess I could put an href wrapped around a "picture-of-a-button", will that work?
0
 
LVL 5

Author Comment

by:volking
ID: 20385672
Can a javascript be executed on a button click? How?
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 12

Expert Comment

by:Rok-Kralj
ID: 20385732
<input id="txtAA" type="text" /><input id="btnAA" type="button" value="Sendto-AA" onclick="document.location='http://mysite.com/AA.aspx'" /><br />
0
 
LVL 12

Expert Comment

by:Rok-Kralj
ID: 20385740
sorry:

<input id="txtAA" type="text" /><input id="btnAA" type="button" value="Sendto-AA" onclick="document.location='http://mysite.com/AA.aspx?id='+document.getElementById('txtAA');" /><br />
0
 
LVL 13

Accepted Solution

by:
R7AF earned 500 total points
ID: 20385771
I would create three separate forms, using normal submit buttons. No javascript required, works in all browsers.
<form action="http://mysite.com/AA.aspx" method="get">
<input id="txtAA" type="text" />
<input id="btnAA" type="submit" value="Sendto-AA" />
</form>
 
<form action="http://mysite.com/BB.aspx" method="get">
<input id="txtBB" type="text" />
<input id="btnBB" type="submit" value="Sendto-BB" />
</form>
 
<form action="http://mysite.com/CC.aspx" method="get">
<input id="txtCC" type="text" />
<input id="btnCC" type="submit" value="Sendto-CC" />
</form>

Open in new window

0
 
LVL 13

Expert Comment

by:R7AF
ID: 20385808
To clarify myself, these three forms are on the same page. And the forms need a name!
<form name="BB" action="http://mysite.com/BB.aspx" method="get">

Open in new window

0
 
LVL 5

Author Comment

by:volking
ID: 20395655
@R7AF - Excellent! And three separate form submissions means each form will URLencode the texbox values automatically, right?
0
 
LVL 13

Expert Comment

by:R7AF
ID: 20395776
Yes! Try and see it yourself.
0
 
LVL 5

Author Closing Comment

by:volking
ID: 31412042
Thanks! It works!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question