Solved

One Page with 3 form submits?

Posted on 2007-11-30
10
166 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article discusses four methods for overlaying images in a container on a web page
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 …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

726 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