By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,550 Members | 2,757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,550 IT Pros & Developers. It's quick & easy.

pass data by query string using submit button

P: n/a
In ASP, when we pass data between pages, we usually pass by query string. If
we pass data by query string, that means we need to use submit button, not
by regular button, and the form will pass to the server since it's GET or
POST request. But if just form-to-form communication, why we need to send
the form to the server? Please help clarify. Thanks!!

<form action="process.asp" method="get">
//form controls

<input type="submit">
</form>

For example, http://www.myserver.com?id=100&name=joe

Form.QueryString("id")
Form.QueryString("name")

Jul 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hi!

First of all you should consider posting most of you data because the
querystring is limited in size.

You can use a standard button if you also allow for example javascript. Just
submit or do what you want in the onclick event.

Not sure I understand the form to form communication. If you have two (or
more forms) in the same html output from your asp page you can use
javascript to set values from one form to another (no need to roundtrip to
server). You cannot access a form that is not loaded to the browser without
a roundtrip to the server. If you view source of you html code and can find
your <form> tag then you can access them without roundtrip.

Regards
/Hans
Jul 19 '05 #2

P: n/a
The browser has to go to the server to get the next page anyway, doesn't it?
If you're talking about form-to-form within one page, you don't have to do
anything with the server.

Ray at home

"Matt" <ma*******@hotmail.com> wrote in message
news:uh**************@TK2MSFTNGP10.phx.gbl...
In ASP, when we pass data between pages, we usually pass by query string. If we pass data by query string, that means we need to use submit button, not
by regular button, and the form will pass to the server since it's GET or
POST request. But if just form-to-form communication, why we need to send
the form to the server? Please help clarify. Thanks!!

<form action="process.asp" method="get">
//form controls

<input type="submit">
</form>

For example, http://www.myserver.com?id=100&name=joe

Form.QueryString("id")
Form.QueryString("name")

Jul 19 '05 #3

P: n/a

Hi

You can use javascript code as follows to transfer values between form
form2.field1.value = form1.field1.value

Cheer

Pravi

----- Matt wrote: ----

In ASP, when we pass data between pages, we usually pass by query string. I
we pass data by query string, that means we need to use submit button, no
by regular button, and the form will pass to the server since it's GET o
POST request. But if just form-to-form communication, why we need to sen
the form to the server? Please help clarify. Thanks!

<form action="process.asp" method="get"
//form control

<input type="submit"></form

For example, http://www.myserver.com?id=100&name=jo

Form.QueryString("id"
Form.QueryString("name"


Jul 19 '05 #4

P: n/a
Ray

The following code means page1.asp will submit the form to server, and then get page2.asp from the server. Right
//page1.as
<form action="page2.asp" method="get"
//form control

<input type="submit"></form

On the other hand, the following code also gets page2.asp from the server, but it won't submit the form of page1.asp to the server. Correct

//page1.as
<script type="text/javascript"
function openWindow(
{ window.open("page2.asp", ...)

</script><input type="button" onClick="openWindow()"

so the rule of thumb is "submit" will send the form data to the server (either by GET or POST protocol), but "button" won't do this. The conclusion is if I have page1.asp, and page2.asp, and wants page2.asp gets the form data of page1.asp, then we need to use "submit" in page1.asp. Correct?

I really need to clarify this. Please advise. Thanks!!
Jul 19 '05 #5

P: n/a
What you said is generally correct. It is possible, however, to build a
querystring using client-side code and still sending the values in your
window.open() though. openWindow('page2.asp?x='+document.form.x.value)

If you want/need to do something like and are unsure how to do it, venture
into a jscript scripting group such as microsoft.public.scripting.jscript.
I believe there are some better Javascript groups that are non-MS hosted
though.

Ray at home


"Matt" <an*******@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
Ray,

The following code means page1.asp will submit the form to server, and then get page2.asp from the server. Right? //page1.asp
<form action="page2.asp" method="get">
//form controls

<input type="submit"></form>

On the other hand, the following code also gets page2.asp from the server, but it won't submit the form of page1.asp to the server. Correct?
//page1.asp
<script type="text/javascript">
function openWindow()
{ window.open("page2.asp", ...);
}
</script><input type="button" onClick="openWindow()">

so the rule of thumb is "submit" will send the form data to the server (either by GET or POST protocol), but "button" won't do this. The conclusion
is if I have page1.asp, and page2.asp, and wants page2.asp gets the form
data of page1.asp, then we need to use "submit" in page1.asp. Correct??
I really need to clarify this. Please advise. Thanks!!

Jul 19 '05 #6

P: n/a
Thanks Ray

When we say submit, and reset the form to the server, or post the form, it means send the form control data to the server (IIS) and store those data for further processing (For example, other page needs that data). But IIS is a server, not a database. How can IIS store those data?

Please advise!!
Jul 19 '05 #7

P: n/a
http://www.aspfaq.com/5007
The page that processes the form when it is submitted can retreive the
values from the request.querystring collection when using method=get or the
request.form collection when using method=post.
http://www.aspfaq.com/5007

<form method=post action=posttome.asp>
<input type="text" name="TheTextBox">
<input type="submit">
</form>
http://www.aspfaq.com/5007
posttome.asp:
<%
Response.Write "The value you entered is " & Request.Form("TheTextBox")
%>
http://www.aspfaq.com/5007
<form method=get action=getme.asp>
<input type="text" name="TheTextBox">
<input type="submit">
</form>
http://www.aspfaq.com/5007
getme.asp:
<%
Response.Write "The value you entered is " &
Request.Qyerystring("TheTextBox")
%>
http://www.aspfaq.com/5007

Ray at home

"Matt" <an*******@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
Thanks Ray.

When we say submit, and reset the form to the server, or post the form, it means send the form control data to the server (IIS) and store those data
for further processing (For example, other page needs that data). But IIS is
a server, not a database. How can IIS store those data?
Please advise!!

Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.