submit the form to the server without opening another page

M

Matt

I want to submit the form to the server without opening another page.

When we do the following, it will submit the form data in myform to
the IIS, and open page2.asp.

<form name="myform" action="page2.asp" method="post">

But I don't want to open another page, I just want to submit the form data.
Should I do the following??
myform.submit();


Please advise. Thanks!!
 
R

Ray at

myform.submit() is just the scripting way to submit the form instead of
waiting for the user to click submit. It'll still do the same thing. You
can always response.redirect back to page1.asp after page2.asp does it's
thing.

Ray at home
 
M

Matt

so basically myform.submit(); will just submit the form to the server, and
doesn't load any page. What I want is to submit the form data and don't open
another page. That's why <form action="page2.asp" method="post"> may not
work for me.

please advise. thanks!!
 
S

Stuart Palmer

Why don't you want to submit the form?
Surely your user wants to knw whether their form has been submitted or not.
What are you trying to do, perhaps someone has done something similar
before.

Regards
Stu
 
P

Patrice

What do you mean but "don't want to open another page" ?

Data are always posted to a page. Usually they are posted to the page that
is currently displayed and the page redisplays itself (but had the time to
update the info in the database or to process these inputs server side).

If the page doesn't sent any HTML output (iincludes clearing headers), I
believe the display will not change (but generally it's probably better to
have visually a change even such a glimpse so that the user knows it's input
is processsed).

Patrice
 
B

Bob Barrows [MVP]

Matt said:
I want to submit the form to the server without opening another page.

When we do the following, it will submit the form data in myform to
the IIS, and open page2.asp.

<form name="myform" action="page2.asp" method="post">

But I don't want to open another page, I just want to submit the form
data. Should I do the following??
myform.submit();

No. myform.submit() does the same thing that clicking te submit button does.

You will need to use XMLHTTP to do this. A google search should provide the
details.

Since using XMLHTTP involves client-side code. it is off-topic for this
group. If you need further help with it, try one of the .scripting groups.

Bob Barrows
 
R

Ray at

Matt said:
so basically myform.submit(); will just submit the form to the server, and
doesn't load any page.

No, myform.submit() will do the same thing that would happen if you (the
user) clicked the submit button.
What I want is to submit the form data and don't open
another page. That's why <form action="page2.asp" method="post"> may not
work for me.

What do you want to see when you submit?

Ray at work
 
M

Matt

Once I click submit button, I want to go to page2.asp in a new window.

That means I should do:
<form action="page2.asp" method="post" target="_blank">

Correct?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top