How do I insert html forms into .aspx pages?

Discussion in 'ASP.NET / ASP.NET Core' started by majamke, Apr 12, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. This will probably seem like an incredibly stupid question...

    My site is written using Expression Web and I'm trying to cut and paste some HTML code
    into .aspx files. The HTML code is just a paypal button and a simple form to email. When I used FrontPage, I just inserted the HTML and it worked fine...
    Now when I insert the HTML and load the page to the server, the link doesnt
    work, it just reloads the current page instead of referring to paypal or posting the form data to the script. This
    is driving my nuts... I've been through help a dozen times, surely it is
    something simple... it works when I drop the HTML into a .htm file, but not
    my .aspx files.

    Any help would be greatly appreciated!
     
  2. Remember the aspx page can have only one form element unlike html and that too handled at the server side (runat='server') .Links should fine though!

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Um, that's great, but how do I insert HTML forms into .aspx web pages?

    For example, why does the following code work with .htm files, but not .aspx files?

    <form action='/formmail.asp' method='post'>
    <p>
    <input name='_recipients' type='hidden' value='[email protected]' />
    <input name='_replyToField' type='hidden'
    value='Email Address' />
    <input name='_requiredFields' type='hidden' value='Name,Email Address,Comments' />
    <input name='_redirect' type='hidden' value='success.aspx' />
    Name: <input name='Name' type='text' />
    Email Address: <input name='Email Address' type='text' />
    Comments:
    <textarea name='Comments' rows=5 cols=50></textarea>
    <input type='submit' value='Submit' />
    <input type='reset' value='Clear' />
    </p>
    </form>
     
  4. Whats the error message that you're receiving. Let us know the URL and instructions on how we can also replicate it.
     
  5. In ASP.NET the form is always submitted to the page itself. If you specify an action attribute, it is ignored. If you omit the method attribute, it will be set to method='post' by default. Also, if you do not specify the name and id attributes, they are automatically assigned by ASP.NET.An .aspx page can only contain ONE <form runat='server'> control! The runat='server' attribute indicates that the form should be processed on the server.It also indicates that the enclosed controls can be accessed by server scripts.

    To have asp.net signle form interface model have a user defined action script see: http://www.codeproject.com/aspnet/CHtmlForm.asp

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. Hi,


    This might be a (frowned aupon) work around, but what I do is link off to an I-Frame that is a page by itself that houses the form I want..

    IE: You can insert something like this in your main page:


    <iframe name="I1" src=http://your domain, and filename.html scrolling="yes" border="0" frameborder="0" style="width: 545px; height: 420px"></iframe> Your form that you need (paypal, etc) will be what's in the page called by the I-Frame,


    Of course you can turn the I-frame scrolling on and off, adjust the width and borders, etc..
    I have all kinds of html forms in Front Page pages that I link to and for most purposes it's very quick and easy. You can have the form go to a thank you or confirmation page that will load into your i-frame as well automatically if you have one.

    Your paypal will work fine this way, and it get's around the "one form" situation with .net
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page