Results 1 to 6 of 6

Thread: form action doesnot work??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Location
    chennai
    Posts
    90

    Unhappy form action doesnot work??

    Hi

    I tried to post a form to another form.. but the form is not submitted to the form specified in the action property..
    Eg. In webform2.aspx
    <form method="post" action="webform3.aspx">
    but the form is submitted to webform2.aspx??

    wot to do if i need to submit to a different form??
    if i cant submit to a different form, then why is the action attribute allowed in form element??

    thanks
    Akalya
    akalya

  2. #2
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    I dont know why it allows a method in an asp.net form because any asp.net form (i.e. with runat=server) will always post to itself.
    I highly recommend you consider using this model because it works quite well and in most cases posting from one form to another can be avoided.
    If however you really need to do so there are ways to do it without posting the form to another page using cookies or session variables and then redirecting to your second page.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Location
    chennai
    Posts
    90

    posting a form and getting values in diff form without using cookies or session

    Hi

    Thanks for ur reply...Wot u say is to assign the values of all the form values to cookies or session variables and then redirect to the form i want to post it to..

    But cookies cannot be used since the user may be disabled cookies.. disabling cookies will also prevent using session variables since sessionid is stored in the client machine..

    Is the only way to send the form variables in the form of querystring??

    Akalya
    akalya

  4. #4
    New Member
    Join Date
    Mar 2002
    Posts
    13
    no u can still use request.form if u use htmlcontrols. if u gonna use servercontrol u need to use their text proberty.

    small example:

    Code:
    <%@ Page Language="VBScript" Debug="true" %>
    <script runat="server" language="vb">
    
        Sub btnsubmit_click(Sender As Object, E As EventArgs)
    
    	response.Write("HtmlControl: " + request.Form("htmlcontrol"))
    	response.Write("<br>ServerControl: " + servercontrol.text)
      
        End Sub
        
    </script>
    <html>
      <body>
        <form runat="server">
          <input type="text" name="htmlcontrol">
        <asp:TextBox ID="servercontrol" runat="server" />
    	<asp:Button ID="submitbtn" runat="server" OnClick="btnsubmit_click" Text="submit" />
        </form>
      </body>
    </html>

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Location
    chennai
    Posts
    90

    no.. it works for posting to the same form only

    Hi

    wot u did is posted to the same form.. wot do u do to post it to a diff form??

    u cannot access this way?.. the only soln is to redirect and use session/Cookie variables or redirect to a page with query string attached.. Am i right

    thanks
    akalya

  6. #6
    New Member
    Join Date
    Mar 2002
    Posts
    13
    hmmm, havnt tried it yet to post to a diff form, cuz there was no need to. i think posting to the same page is one of the great benefits asp.net supports, and u can save through this a lot of pages.
    but to ur question, it should be still possible if u only use htmlcontrols or when ur form tag has no runat=server method, maybe u give this a try.

    greetings

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width