Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

One Page with 3 form submits?

Posted on 2007-11-30
10
Medium Priority
?
169 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
[X]
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
  • 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

610 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