why does the HTML widget do not have a "name" attribute?

42 views
Skip to first unread message

wahaha

unread,
Oct 20, 2011, 3:26:47 AM10/20/11
to Google Web Toolkit
why does the HTML widget do not have a "name" attribute?

Thomas Broyer

unread,
Oct 20, 2011, 4:27:12 AM10/20/11
to google-we...@googlegroups.com
Why would it?

wahaha

unread,
Oct 20, 2011, 11:23:47 PM10/20/11
to Google Web Toolkit
can you more clearly?

On Oct 20, 4:27 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> Why would it?

wahaha

unread,
Oct 21, 2011, 12:05:46 AM10/21/11
to Google Web Toolkit
and the Label widget do not have a "name" attribute too,why??????

Gal Dolber

unread,
Oct 21, 2011, 12:35:09 AM10/21/11
to google-we...@googlegroups.com
The HTML widget is implemented with a div.. so there's no reason to set a name...
 
If you still want to set the name attribute to it: htmlWidget.getElement().setAttribute("name", "SomeName");

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




--
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/




Gal Dolber

unread,
Oct 21, 2011, 1:51:42 AM10/21/11
to google-we...@googlegroups.com
OMG

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

Thomas Broyer

unread,
Oct 21, 2011, 5:27:38 AM10/21/11
to google-we...@googlegroups.com
Let me rephrase: why do you want it to have a name? what would you use it for? what problem are you trying to solve?

(and this is a general comment as to all your questions here; you're sort-of spamming the group with questions which you obviously didn't even try to answer by yourself; state the problem you're trying to solve, what you tried and didn't work, what you found that didn't match; when you show people that you put a minimum of effort, then they'll be inclined to answer, possibly after doing some research themselves)

wahaha

unread,
Oct 21, 2011, 6:18:56 AM10/21/11
to Google Web Toolkit
it is very simple reason.i want add a "name" attribute to the "Lable"
tag,and then write css rules for the tag in ui.xml

Thomas Broyer

unread,
Oct 21, 2011, 6:31:08 AM10/21/11
to google-we...@googlegroups.com
"name" won't help for CSS.


<ui:style>
.myLabel {
coor: red;
}
</ui:style>
...
<g:Label addStyleNames="{style.myLabel}">foo</g:Label>

wahaha

unread,
Oct 23, 2011, 10:57:15 PM10/23/11
to Google Web Toolkit
if "name" wont help for css as you say,then what is the substitute for
the "id" attribute in html?

On Oct 21, 6:31 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> "name" won't help for CSS.
>
> Seehttp://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#He...

Thomas Broyer

unread,
Oct 24, 2011, 2:54:42 AM10/24/11
to google-we...@googlegroups.com
Nothing. Use CSS classes. What's wrong with them?

wahaha

unread,
Oct 24, 2011, 10:52:25 PM10/24/11
to Google Web Toolkit
nothing wrong,but if there is just one widget need to be styled
alonely,we use css classes,it does not in accordance with the
principles of html designing.

Thomas Broyer

unread,
Oct 25, 2011, 6:35:23 AM10/25/11
to google-we...@googlegroups.com
GWT cannot know how many instances of your component you'll instantiate in the lifetime of your application, so it doesn't make it easy to give widgets an ID. It's still possible though (myWidget.getElement().setId("myId"), which supposes you know what you're doing).

See also https://github.com/stubbornella/csslint/wiki/Disallow-ids-in-selectors (please read the linked blog post, and also follow links from there)
Reply all
Reply to author
Forward
0 new messages