Copied to clipboard

Flag this post as spam?

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


  • Nikolas van Etten 202 posts 162 karma points
    Mar 19, 2010 @ 00:12
    Nikolas van Etten
    0

    Add Contour form based on field value

    Any way to accomplish this? User will set true/false to a field value "displayContactForm". Easy (and dirty) way is to use css, but not a good alternative, although I'll go with that if there's no other options.

  • Comment author was deleted

    Mar 19, 2010 @ 11:22

    Sure nikolas,

    You could simply do this in your template.

    Check this example (it's in blog4umbraco, it hides the comment form if the field value "close comments" is true)

    http://blog4umbraco.codeplex.com/SourceControl/changeset/view/40819#685144

    These parts are important:

    <script runat="server">
    bool closeComments = false;

    void Page_Load(object sender, System.EventArgs ea) {
    try{
    if(umbraco.presentation.nodeFactory.Node.GetCurrent().GetProperty("closeComments").Value == "1")
    closeComments = true;
    }
    catch(System.NullReferenceException){}
    }
    </script>
    <% if (!closeComments) { %>

     

     

    <% } %>

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft