Copied to clipboard

Flag this post as spam?

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


  • MartinB 411 posts 512 karma points
    Aug 05, 2012 @ 22:20
    MartinB
    0

    Deleting the masterform (runat server) stuff?

    Hi there

    In my umbMaster.master i have this:

    <form id="RunwayMasterForm" runat="server">
        <asp:contentplaceholder id="cp_content" runat="server"></asp:contentplaceholder>
    </form>

    This is breaking my MailChimp signup form that i've inserted into a xslt macro inserted on my Homepage.master.

    When removing the above form everything works as intended, but before i keep that solution i wanted to ask what this asp.net form is even good for and why it's there in the first place?

    Could i not just my "runat=server" forms on the templates where needed, instead of residing in the umbMaster.master?

    Any insights are much appreciated.

  • MartinB 411 posts 512 karma points
    Aug 05, 2012 @ 22:22
    MartinB
    0

    Could i not just my "runat=server"

    Could i not just *add* my....

  • Richard Brookes 34 posts 57 karma points
    Aug 06, 2012 @ 01:58
    Richard Brookes
    1

    Hi Martin,

    This is a classic problem in ASP.NET. Basically you can't nest forms inside the main asp.net form (i.e the one with runat=server) Also you can only have one form with runat=server on a page. This causes headaches when using things like paypal or email signup forms etc because they usually involve a form that posts to a remote server somewhere.

    Any ASP.NET controls that require a postback must be contained inside a form tag with runat=server. Umbraco doesn't need this if you are just displaying content but if for example you wanted to put a login control or any kind of form tht requires postback you would run into an error if it is not inside a form with runat=server.

    By default Umbraco master page has the form quite high up so most things are containd inside it. Usually I take it out altogether and just use standard HTML forms on my pages but if I do need to use ASP.NET controls that need it, I just add the form with runat = server at a lower  level so just my controls that need it are contained by it. As long as your mail signup form is outside of the ASP.NET form you will be fine.

    I have read lots of work arounds including ideas like ghost forms but I have rarely come accross a situation in umbraco where I can't just move my form to get around the issue.

    I hope this helps

    cheers

  • MartinB 411 posts 512 karma points
    Aug 06, 2012 @ 09:56
    MartinB
    0

    Hi Richard

    Thanks for the details. Much appreciated :-)

    In my case it's safe to remove it for now and add it on a lower level, if needed - as i had expected.

    Better safe than sorry though ;)

     

Please Sign in or register to post replies

Write your reply to:

Draft