Submit Button

Discussion in 'ASP .Net' started by bbawa1@yahoo.com, Jun 12, 2007.

  1. Guest

    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
    , Jun 12, 2007
    #1
    1. Advertising

  2. 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:...
    >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
    >
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], Jun 12, 2007
    #2
    1. Advertising

  3. Mark Rae Guest

    <> wrote in message
    news:...

    >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
    Mark Rae, Jun 12, 2007
    #3
  4. Guest

    On Jun 12, 11:21 am, "Mark Rae" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    >
    >
    >
    >
    > >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.
    , Jun 12, 2007
    #4
  5. Mark Rae Guest

    <> wrote in message
    news:...

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


    Are you still getting an error...?


    --
    http://www.markrae.net
    Mark Rae, Jun 12, 2007
    #5
  6. Guest

    On Jun 12, 12:20 pm, "Mark Rae" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > > 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);
    , Jun 12, 2007
    #6
  7. Mark Rae Guest

    <> wrote in message
    news:...
    > On Jun 12, 12:20 pm, "Mark Rae" <> wrote:
    >> <> wrote in message
    >>
    >> news:...
    >>
    >> > 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
    Mark Rae, Jun 12, 2007
    #7
  8. Guest

    On Jun 12, 12:20 pm, "Mark Rae" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > > 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
    , Jun 12, 2007
    #8
  9. Guest

    On Jun 12, 12:44 pm, "Mark Rae" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    >
    >
    >
    >
    > > On Jun 12, 12:20 pm, "Mark Rae" <> wrote:
    > >> <> wrote in message

    >
    > >>news:...

    >
    > >> > 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);
    , Jun 12, 2007
    #9
  10. Mark Rae Guest

    <> wrote in message
    news:...
    > On Jun 12, 12:20 pm, "Mark Rae" <> 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
    Mark Rae, Jun 12, 2007
    #10
  11. Mark Rae Guest

    <> wrote in message
    news:...

    > Thanks a lot for your concern. I am sending you my code for both
    > pages.


    See my previous reply...

    Why are you using two pages for this, AAMOI...?


    --
    http://www.markrae.net
    Mark Rae, Jun 12, 2007
    #11
  12. Guest

    On Jun 12, 1:07 pm, "Mark Rae" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > > On Jun 12, 12:20 pm, "Mark Rae" <> 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


    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
    , Jun 12, 2007
    #12
  13. Mark Rae Guest

    <> wrote in message
    news:...

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


    For the third time:

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


    --
    http://www.markrae.net
    Mark Rae, Jun 12, 2007
    #13
  14. Guest

    On Jun 12, 1:44 pm, "Mark Rae" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > > But It is not giving me any output on the processform.aspx page. It
    > > is blank

    >
    > 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.
    , Jun 12, 2007
    #14
  15. Mark Rae Guest

    <> wrote in message
    news:...

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


    --
    http://www.markrae.net
    Mark Rae, Jun 12, 2007
    #15
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    1
    Views:
    1,667
  2. Ghafran Abbas
    Replies:
    0
    Views:
    4,183
    Ghafran Abbas
    Oct 12, 2004
  3. Replies:
    2
    Views:
    6,167
  4. Network-Man
    Replies:
    5
    Views:
    78,209
    gaul1
    Jul 7, 2012
  5. Guest
    Replies:
    2
    Views:
    1,562
    Guest
    Oct 25, 2004
Loading...

Share This Page