Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8747881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:25:51+00:00 2026-06-13T12:25:51+00:00

I’m building a GUI extension that includes a popup that is opened on the

  • 0

I’m building a GUI extension that includes a popup that is opened on the click of a new button in the ribbon bar. The popup includes a dropdown that is dynamically populated with some information gathered from the system using the Core Service. At least that’s the idea. I am able to get the button to appear, and it opens the popup, but as soon as I start with the javascript for the popup I get an error Unable to get unique id for element and the CME doesn’t finish loading. Here’s what I have so far:

Popup ASPX

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SwitchUserPopup.aspx.cs" Inherits="SwitchUser.Popups.SwitchUserPopup" %>
<%@ Import Namespace="Tridion.Web.UI.Core" %>
<%@ Import Namespace="Tridion.Web.UI" %>
<%@ Import Namespace="System.Web" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://www.sdltridion.com/web/ui/controls">
<head runat="server">
    <title>Select User</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <h1>Select User</h1>
            <c:dropdown id="SwitchUserDropdown" runat="server" nullable="false"/>
        </div>
    </form>
</body>
</html>

Popup ASPX Code

namespace SwitchUser.Popups
{
    [ControlResourcesDependency(new [] { typeof(Popup),
                                         typeof(Tridion.Web.UI.Controls.Button),
                                         typeof(Stack),
                                         typeof(Dropdown),
                                         typeof(List) })]
    [ControlResources("SwitchUser.Resources")]
    public partial class SwitchUserPopup : TridionPage
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            TridionManager tm = new TridionManager();

            tm.Editor = "SwitchUser";
            System.Web.UI.HtmlControls.HtmlGenericControl dep =
                    new System.Web.UI.HtmlControls.HtmlGenericControl("dependency");
            dep.InnerText = "Tridion.Web.UI.Editors.CME";
            tm.dependencies.Add(dep);

            System.Web.UI.HtmlControls.HtmlGenericControl dep2 =
                    new System.Web.UI.HtmlControls.HtmlGenericControl("dependency");
            dep2.InnerText = "Tridion.Web.UI.Editors.CME.commands";
            tm.dependencies.Add(dep2);

            //Add them to the Head section
            this.Header.Controls.Add(tm); //At(0, tm);
        }
    }
}

Popup JS

Type.registerNamespace("SwitchUser.Popups");

SwitchUser.Popups.SwitchUser = function (element) {
    Type.enableInterface(this, "SwitchUser.Popups.SwitchUser");
    this.addInterface("Tridion.Cme.View");
};

SwitchUser.Popups.SwitchUser.prototype.initialize = function () {
    $log.message("Initializing Switch User popup...");
    this.callBase("Tridion.Cme.View", "initialize");

    var p = this.properties;
    var c = p.controls;

    c.UserDropdown = $controls.getControl($("#SwitchUserDropdown"), "Tridion.Controls.Dropdown");
};

$display.registerView(SwitchUser.Popups.SwitchUser);

The extension is configured correctly in System.config – I can see the log message in the javascript console. However, I also see this Unable to get unique id for element error with the following additional information:

anonymous(object{..})
WebRequest.completed(object{..})
Net.loadFile$onComplete(object{..})
Net.loadFile$onOperationCompleted()
Xml.loadXmlDocuments$onSuccess(array1)
Xml.loadXmlDocument$onSuccess(array1)
Dropdown.setup$filesLoaded(object{..})
setupDone()
anonymous(function: DisplayController$start())
DisplayController.start()
anonymous()
anonymous(undefined, “Tridion.Controls.Dropdown”)
Tridion.Assert$raiseError(“Unable to get unique id for element.”)

From that logged info it seems that the problem is the dropdown. If I comment out the line in my JS that registers the view then I don’t get the error, but I also don’t get the log message so I suspect that this is a mandatory call. Can anyone shed any light on why this might be happening? I’ve been using the Example PowerTool code as a reference, and I believe I’ve replicated what is there…

Update

I tried to step through the code – I found a suitable line and placed a breakpoint there. Then I reloaded the CME and suddenly my breakpoint was on a line that had no relevance to my code, and I couldn’t find anything related to my code. However, according to the console it is still being executed.

So, instead I put log messages in my initialize method as follows:

SwitchUser.Popups.SwitchUser.prototype.initialize = function () {
    $log.message("Initializing Switch User popup...");
    this.callBase("Tridion.Cme.View", "initialize");
    $log.message("Tridion.Cme.View callBase done");
    var p = this.properties;
    var c = p.controls;
    $log.message("Set properties and controls");
    c.UserDropdown = $controls.getControl($("#SwitchUserDropdown"), "Tridion.Controls.Dropdown");
    $log.message("Got UserDropdown control");
};

I can see in the console that it logs as far as Set properties and controls and then I get the error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:25:52+00:00Added an answer on June 13, 2026 at 12:25 pm

    I put a breakpoint in the getControl method and was able to determine why I was getting the error. $("#SwitchUserDropdown") was not finding anything so when the code below was running it threw the error:

    var id = Tridion.Utils.Dom.getUniqueID(element);
    if (id)
    {
        var control = instances[id];
        if (!control)
        {
            control = instances[id] = new ctor(element, settings);
            if (Tridion.Type.isFunction(control.initialize))
            {
                control.initialize();
            }
        }
    }
    else
    {
        Tridion.Utils.Assert.raiseError("Unable to get unique id for element.");
    }
    return control; 
    

    It seems obvious now that I know why it was happening that the code was running at the wrong time. I believe it shouldn’t run when the CME loads, but only when the popup is opened. This leads me to look at the configuration of the resources in my Editor config file. I had previously grouped my popup’s JS with other resources associated with the ribbon toolbar button. By placing the popup specific resources in their own resource group I was able to stop the error and successfully get the control.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.