Solved

One Page with 3 form submits?

Posted on 2007-11-30
10
155 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
Comment Utility
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
Comment Utility
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
Comment Utility
Can a javascript be executed on a button click? How?
0
 
LVL 12

Expert Comment

by:Rok-Kralj
Comment Utility
<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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 13

Accepted Solution

by:
R7AF earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
@R7AF - Excellent! And three separate form submissions means each form will URLencode the texbox values automatically, right?
0
 
LVL 13

Expert Comment

by:R7AF
Comment Utility
Yes! Try and see it yourself.
0
 
LVL 5

Author Closing Comment

by:volking
Comment Utility
Thanks! It works!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now