Copied to clipboard

Flag this post as spam?

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


  • Gregg Duncan 48 posts 70 karma points
    Dec 28, 2010 @ 00:07
    Gregg Duncan
    0

    Javascript Error: Umbraco.Controls.TreePicker is undefined

    I created a .Net User Control macro with public properties. One of those properties is a textMultiLine type. When I try to add the macro to my template I'm getting a javascript error "Umbraco.Controls.TreePicker is undefined". The Firefox error console is pointing me to this line in the umbraco/dialogs/editMacro.aspx page, line 41.

    var picker = Umbraco.Controls.TreePicker.GetPickerById(controlId);

    Does anyone know what could be causing this. One of the 4 Macros I created works fine. The other 3 all give me this error.

    Help please.

  • Brendan Rice 538 posts 1102 karma points
    Mar 29, 2011 @ 18:15
    Brendan Rice
    0

    Did you ever get a fix for this? I am getting the same issue with Umbraco 4.7 on Firefox 4

  • Gregg Duncan 48 posts 70 karma points
    Mar 29, 2011 @ 18:45
    Gregg Duncan
    0

    No, I found a work around.

    Rather than trying to pass parameters into the macro, I set the values I wanted to pass as parameters as properties of a page then pulled them the page properties. I created a Helper class with the methods below to check the Node tree for the property and return the value.

    public class umbracoHelpers{
    /// Does a recursive check up the node tree to find a property with the specified alias.
    /// If found it returns its value.
    /// If not found it returns an empty string.
    public static string getNodeValueRecursively(Node node, string alias)
    {
    string value = checkNodeForValue(node, alias);
    while (string.IsNullOrEmpty(value) && node.Parent != null)
    {
    node = node.Parent;
    value = umbracoHelpers.checkNodeForValue(node, alias);
    }
    return value;
    }

    /// Checks the current node for a property with the
    /// specified alias and returns that properties value if found.
    /// Returns an empty string if the alias is not found.
    public static string checkNodeForValue(Node node, String alias)
    {
    string code = string.Empty;
    foreach (Property prop in node.Properties)
    {
    if (prop.Alias != alias)
    continue;
    code = prop.Value;
    break;
    }
    return code;
    }
    }

    I hope this helps you.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies