Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anders 3 posts 23 karma points
    Oct 01, 2009 @ 15:49
    Anders
    0

    Error on use - A page can have only one server-side Form tag

    Hi,

    When I publish the page with the contact form and navigate to it, I get this error:

    A page can have only one server-side Form tag

    Where can I have double Form tags in this case?

    Thanks!

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Oct 01, 2009 @ 17:06
    Lee Kelleher
    0

    As the error says, you are only allowed to use one server-side form tag on an ASPX page.

    There is nothing stopping you from having other form tags on the same page, as long as they aren't runat="server" ... and nested form tags also are a bit of a taboo - they work in some browsers, and fail miserably in others (yes, IE we're pointing at you!).

  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    Oct 01, 2009 @ 17:07
    Sebastiaan Janssen
    0

    Have a look at your master and their related templates..

    You don't have to surround the contact form macro with the <form runat="server"> tag. It is already in the user control (usercontrols/cultivcontactform.aspx). You might want to try to remove the <form> tags from cultivcontactform.aspx or (if you don't need them) from your master pages.

    Let me know if I can help!

  • sewi 15 posts 35 karma points
    Oct 15, 2009 @ 17:13
    sewi
    0

    Hi,

    i have the same issue - when i remove the form tags from cultivcontactform.aspx i get:

    Control 'ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ContentPlaceHolder_CultivContactForm_2__contactName' of type 'TextBox' must be placed inside a form tag with runat=server

     

    what should i do?

    greetz

    Sewi

  • Frederik Vig 29 posts 61 karma points
    Oct 15, 2009 @ 20:10
    Frederik Vig
    0

    Hi

    The textbox control needs to be inside a form tag with the attribute runat="server". I would remove the other form tag (without the runat="server attribute) and just have everything inside the <form runat="server"> tag. If that is a problem check this blog post - http://www.frederikvig.com/2009/06/using-multiple-forms-on-an-asp-net-web-forms-page/.

    Hope this helps.

     

  • sewi 15 posts 35 karma points
    Oct 16, 2009 @ 10:47
    sewi
    0

    Hi Frederik,

    i don't know which other form tag you mean.

    I have one form tag in my master-template

    <div id="content">
                <div class="clearall"></div>
                <form id="Contentwindow" runat="server" />
                    <asp:ContentPlaceHolder id="ContentPlaceHolder" runat="server"></asp:ContentPlaceHolder>
                </form>
    </div>

    and one in the cultivcontactform.aspx

    <form id="_cultivContactForm" runat="server">
    <div id="cultivContact">
        <fieldset>
            <div class="inputRow">
                <asp:Label ID="_nameLabel" class="formLabel" runat="server" Text="Label"></asp:Label>
                <asp:TextBox runat="server" ID="_contactName" class="inputString"></asp:TextBox>

    which should i remove?

     

     

  • Frederik Vig 29 posts 61 karma points
    Oct 16, 2009 @ 14:46
    Frederik Vig
    2

    In what ContentPlaceHolder are you adding the _cultivContactForm? If it is the one with the id of ContentPlaceHolder, remove the form in cultivcontactform.aspx.

    If you use another ContentPlaceHolder control make sure that the Contentwindow form contains that ContentPlaceHolder control as well, before removing the _cultivContactForm.

    Example:

    <asp:ContentPlaceHolder ruant="server" ID="SomeOtherContentPlaceHolder">
    </asp:ContentPlaceHolder>

    <!-- Note also that I removed the self closing /> on the form since we're closing it below -->
    <form runat="server ID="Contentwindow">
    <asp:ContentPlaceHolder runat="server" ID="ContentPlaceHolder">
    </asp:ContentPlaceHolder>
    </form>

    Should be:

    <form runat="server ID="Contentwindow">
    <asp:ContentPlaceHolder ruant="server" ID="SomeOtherContentPlaceHolder">
    </asp:ContentPlaceHolder>

    <asp:ContentPlaceHolder runat="server" ID="ContentPlaceHolder">
    </asp:ContentPlaceHolder>
    </form>

    Basically make sure you only have one form with the runat="server" attribute! :).

    Hope this helps.

  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    Oct 18, 2009 @ 11:30
    Sebastiaan Janssen
    0

    Thanks Frederik, for giving support while I was unaware of the questions here! I have just found out that each forum has it's own RSS feed, so I can keep track on new questions in the support forums.

    Anyway, you've explained it well. I've just tested to make sure that either method works, and it sure does!

  • sewi 15 posts 35 karma points
    Oct 19, 2009 @ 10:11
    sewi
    0

    Thanks Frederik,

    thats it!

    I got it work - really nice work

Please Sign in or register to post replies

Write your reply to:

Draft