On 15 nov, 18:12, Janusz <[email protected]> wrote:
> Hello,
>   I've been looking for a way to set DOM element id trough UIBinder
> but I couldn't find any solution. Example of what I'd like to do:
>
> <g:HTMLPanel>
>   <label for="usernameInput">Some label</label>
>   <g:TextBox ui:field="field" id="usernameInput"/>
> </g:HTMLPanel>
>
> Id like this to be rendered as:
> <div>
>   <label for="usernameInput">Some label</label>
>   <input type="text" id="usernameInput" />
> </div>
>
> Sadly this doesn't work the way I wanted it to. As far as I can
> understand id attribute in UIBinder is treated as an id for XML
> element that is being parsed by UIBinder processor.

No, actually, using ui:field="" implies adding a (temporary) id to the
element (or a placeholder element in your case) so it can be retrieved
later (in your case, to replace it with the TextBox through
HTMLPanel's addAndReplaceElement method)

> I've tried things
> like JSP/JSF syntax:
>
>   <g:TextBox ui:field="field" element.id="usernameInput"/>
>
> but this doesn't work either. Does anyone know if it is possible in
> UIBinder to set an id for resulting DOM element? Currently to achieve
> this one has to go to java code and use field.getElement().setId().

See https://wave.google.com/wave/waveref/googlewave.com/w+EI8yh67GA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to