Hi Ray et al,

Looking at the UiBinder wiki page and heading a bit in the code, I
cannot find if it is possible for UiBinder to generate IDs to
associate two elements/widgets, such as an HTML <label> and an <input>
or <ui:TextBox> (but also an <img> and a <map>, or aria-describedby
for example).

Here's how I'm doing it currently with HTMLPanel (HTML element, and
widget):

    String textId = HTMLPanel.createUniqueId();
    String listId = HTMLPanel.createUniqueId();
    HTMLPanel panel = new HTMLPanel("<table>"
        + "<tr valign=top><td><label for=" + textId + ">" +
messages.text() + "</label>"
            + "<td><input id=" + textId + "><span class=required>*</
span></td>"
        + "<tr valign=top><td><label for=" + listId + ">" +
message.list() + "</label>"
            + "<td><span id=" + listId + "></span>"
        + "</table>");

    textBox = InputElement.as(panel.getElementById(textId));

    HTMLPanel.addAndReplace(listBox, listId);
    // little bit of trickery to re-associate the label and the
listbox
    listBox.getElement().setId(listId);

Is this supported by UiBinder's XML syntax? or would I have to inject
the <label> into a LabelElement @Field and generate a new ID to
associate the LabelElement and its InputElement or ListBox? (in other
words, do it by hand)
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to