Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Submit Button

Reply
Thread Tools

Submit Button

 
 
bbawa1@yahoo.com
Guest
Posts: n/a
 
      06-12-2007
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

 
Reply With Quote
 
 
 
 
Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
Guest
Posts: n/a
 
      06-12-2007
That's because Response.Redirect is not JavaScript.

Try something like this instead:

document.location = "processform.aspx";

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net



<> wrote in message
news: oups.com...
>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
>


 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      06-12-2007
<> wrote in message
news: oups.com...

>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...!


--
http://www.markrae.net

 
Reply With Quote
 
bbawa1@yahoo.com
Guest
Posts: n/a
 
      06-12-2007
On Jun 12, 11:21 am, "Mark Rae" <m...@markNOSPAMrae.net> wrote:
> <bba...@yahoo.com> wrote in message
>
> news: oups.com...
>
>
>
>
>
> >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...!
>
> --http://www.markrae.net- Hide quoted text -
>
> - Show quoted text -



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


 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      06-12-2007
<> wrote in message
news: ups.com...

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


Are you still getting an error...?


--
http://www.markrae.net

 
Reply With Quote
 
bbawa1@yahoo.com
Guest
Posts: n/a
 
      06-12-2007
On Jun 12, 12:20 pm, "Mark Rae" <m...@markNOSPAMrae.net> wrote:
> <bba...@yahoo.com> wrote in message
>
> news: ups.com...
>
> > Still It's not going to my processform.aspx.

>
> 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);

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      06-12-2007
<> wrote in message
news: ups.com...
> On Jun 12, 12:20 pm, "Mark Rae" <m...@markNOSPAMrae.net> wrote:
>> <bba...@yahoo.com> wrote in message
>>
>> news: ups.com...
>>
>> > Still It's not going to my processform.aspx.

>>
>> 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...


--
http://www.markrae.net

 
Reply With Quote
 
bbawa1@yahoo.com
Guest
Posts: n/a
 
      06-12-2007
On Jun 12, 12:20 pm, "Mark Rae" <m...@markNOSPAMrae.net> wrote:
> <bba...@yahoo.com> wrote in message
>
> news: ups.com...
>
> > Still It's not going to my processform.aspx.

>
> 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

 
Reply With Quote
 
bbawa1@yahoo.com
Guest
Posts: n/a
 
      06-12-2007
On Jun 12, 12:44 pm, "Mark Rae" <m...@markNOSPAMrae.net> wrote:
> <bba...@yahoo.com> wrote in message
>
> news: ups.com...
>
>
>
>
>
> > On Jun 12, 12:20 pm, "Mark Rae" <m...@markNOSPAMrae.net> wrote:
> >> <bba...@yahoo.com> wrote in message

>
> >>news: roups.com...

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

>
> >> 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...
>
> --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);

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      06-12-2007
<> wrote in message
news: oups.com...
> On Jun 12, 12:20 pm, "Mark Rae" <m...@markNOSPAMrae.net> wrote:


> But It is not going to processform.aspx


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

Change return true; to
return false;


--
http://www.markrae.net

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert form to submit on load instead of clicking submit button? Network-Man HTML 5 07-07-2012 12:06 PM
submit the form data to the popup window without a submit button jrefactors@hotmail.com HTML 2 01-01-2005 06:07 AM
Preventing Multiple submit (Disabling Submit Button Post Click) Solution Mark ASP .Net 1 12-13-2004 08:03 PM
Form submit - hitting enter does not trigger Submit button ASP General 2 10-25-2004 03:37 PM
Disable Submit Button on Post back and On Submit in ASP.net Ghafran Abbas ASP .Net 0 10-12-2004 06:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57