Submit Button

B

bbawa1

I have a sumit button in aspx page.

<input name="Submit" type="submit" onclick =
"showProcessform()"value="Submit">

<script type="text/javascript">
function showProcessform()
{
Response.Redirect("processform.aspx");
return true;
}

</script>

when I click on button it doesn'r redirect me to processform.aspx
page. It gives me error
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

That's because Response.Redirect is not JavaScript.

Try something like this instead:

document.location = "processform.aspx";
 
M

Mark Rae

I have a sumit button in aspx page.

<input name="Submit" type="submit" onclick =
"showProcessform()"value="Submit">

<script type="text/javascript">
function showProcessform()
{
Response.Redirect("processform.aspx");
return true;
}

</script>

when I click on button it doesn'r redirect me to processform.aspx
page.

You're trying to use C# (Response.Redirect) in a client-side function - use
window.location='processform.aspx'; instead...
It gives me error

In future, please don't simply say "It gives me an error" without actually
telling the group what the error is...!
 
B

bbawa1

You're trying to use C# (Response.Redirect) in a client-side function - use
window.location='processform.aspx'; instead...


In future, please don't simply say "It gives me an error" without actually
telling the group what the error is...!

--http://www.markrae.net- Hide quoted text -

- Show quoted text -


Still It's not going to my processform.aspx.
 
B

bbawa1

Are you still getting an error...?

--http://www.markrae.net

I am not getting any error now but in my process.aspx page i have the
following in page_load method but It is not doing any thing

string strFirstName = Request.Form["fvFirstName"];
string strLastName = Request.Form["fvLastName"];
string strEmailAddress = Request.Form["fvEmailAddress"];
string strPhoneService = Request.Form["fvPhoneService"];

Response.Write(strFirstName);
Response.Write(strLastName);
Response.Write(strEmailAddress);
Response.Write(strPhoneService);
 
M

Mark Rae

Are you still getting an error...?

--http://www.markrae.net

I am not getting any error now but in my process.aspx page i have the
following in page_load method but It is not doing any thing

string strFirstName = Request.Form["fvFirstName"];
string strLastName = Request.Form["fvLastName"];
string strEmailAddress = Request.Form["fvEmailAddress"];
string strPhoneService = Request.Form["fvPhoneService"];

Response.Write(strFirstName);
Response.Write(strLastName);
Response.Write(strEmailAddress);
Response.Write(strPhoneService);


Can you please provide the entire code for all pages concerned - it's
starting to look like you're using the old ASP Classic method of having a
separate page for form processing...
 
B

bbawa1

Are you still getting an error...?

--http://www.markrae.net

In main form I have submit button and one javascrip function.

<input name="Submit" type="submit" style="font-size:11px" onclick =
"showProcessform()" value="Submit">

function showProcessform()
{
window.location = "processform.aspx";
return true;
}

But It is not going to processform.aspx
 
B

bbawa1

I am not getting any error now but in my process.aspx page i have the
following in page_load method but It is not doing any thing
string strFirstName = Request.Form["fvFirstName"];
string strLastName = Request.Form["fvLastName"];
string strEmailAddress = Request.Form["fvEmailAddress"];
string strPhoneService = Request.Form["fvPhoneService"];
Response.Write(strFirstName);
Response.Write(strLastName);
Response.Write(strEmailAddress);
Response.Write(strPhoneService);

Can you please provide the entire code for all pages concerned - it's
starting to look like you're using the old ASP Classic method of having a
separate page for form processing...

--http://www.markrae.net- Hide quoted text -

- Show quoted text -

Thanks a lot for your concern. I am sending you my code for both
pages.
#########################################################
Contactus.aspx
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script type="text/javascript">
function showProcessform()
{
window.location = "processform.aspx";
return true;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" action="processform.aspx" method="post"
runat="server">
<div>
<input id="fvFirstName" type="text" /><br />
<br />
<input id="fvLastName" type="text" />
<br />
<input id="fvEmailAddress" type="text" /><br />
<input name="Submit" type="submit" style="font-
size:11px" onclick = "showProcessform()" value="Submit">
</div>
</form>
</body>
</html>
########################################
processform.aspx

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">



protected void Page_Load(object sender, EventArgs e)
{
string strFirstName = Request.Form["fvFirstName"];
string strLastName = Request.Form["fvLastName"];
string strEmailAddress = Request.Form["fvEmailAddress"];
Response.Write(strFirstName);
Response.Write(strLastName);
Response.Write(strEmailAddress);

string[] getInfo1 = new string[2];
InsertIntotbTickets(strFirstName, strLastName,
strEmailAddress);
 
B

bbawa1

Change your onclick to:
onclick="return showProcessform();"

Change return true; to
return false;

--http://www.markrae.net

Thanks It now redirecting me to processform.aspx. But I can't capture
the form fields from Contactus.aspx to processform.aspx.
In processform.aspx I have the following piece of code in page_load.
protected void Page_Load(object sender, EventArgs e)
{
string strFirstName = Request.Form["fvFirstName"];
string strLastName = Request.Form["fvLastName"];
string strEmailAddress = Request.Form["fvEmailAddress"];
Response.Write(strFirstName);
Response.Write(strLastName);
Response.Write(strEmailAddress);

But It is not giving me any output on the processform.aspx page. It
is blank
 
B

bbawa1

For the third time:

why are you using two pages for this...?

--http://www.markrae.net

One page so Contactus.aspx so that I can fill my data in input fiels
and when I click on a button on it redirect me to processform.aspx so
that I can see the data.
 
M

Mark Rae

One page so Contactus.aspx so that I can fill my data in input fiels
and when I click on a button on it redirect me to processform.aspx so
that I can see the data.

There is no need whatever to have more than one page for this...
 

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,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top