You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Co...@bnz.co.nz on 2006/04/19 23:24:48 UTC

Colons in component ids

Is it mandated that component ids use colons, e.g. form:comp?

We have had some problems with a CSS that was using id selectors to apply
styles to particular elements. However, colon is not valid in a CSS id
selector. Is it possible to change the character that JSF uses in ids? It
seems odd that JSF would do something that is incompatible with CSS.

--
Colin Sharples


At Bank of New Zealand, we've got lots of ways to help both you and your
money be better off.



CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify Bank of New Zealand immediately. Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Bank of New Zealand.

Re: Colons in component ids

Posted by Matthias Wessendorf <ma...@apache.org>.
:) this question has to be asked to eg of JSF.

However, when using MyFaces use <t:inputText id="foo" forceId="true" ...

this won't generate something like "form:foo", only "foo".
Look at [1] for more on that

-Matthias

[1] http://www.irian.at/myfaces/forceId.jsf

On 4/19/06, Colin_Sharples@bnz.co.nz <Co...@bnz.co.nz> wrote:
>
> Is it mandated that component ids use colons, e.g. form:comp?
>
> We have had some problems with a CSS that was using id selectors to apply
> styles to particular elements. However, colon is not valid in a CSS id
> selector. Is it possible to change the character that JSF uses in ids? It
> seems odd that JSF would do something that is incompatible with CSS.
>
> --
> Colin Sharples
>
>
> At Bank of New Zealand, we've got lots of ways to help both you and your
> money be better off.
>
>
>
> CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify Bank of New Zealand immediately. Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Bank of New Zealand.
>


--
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
http://jroller.com/page/mwessendorf
mwessendorf-at-gmail-dot-com

Re: Colons in component ids

Posted by Adam Winer <aw...@gmail.com>.
This was specifically discussed on the EG;  a problem
is that NamingContainer.SEPARATOR_CHAR is a static String
constant, so there's no way to introduce an API to set it
without breaking backwards compatibility - any code that
referred to SEPARATOR_CHAR would have to be changed
to point at a new API, or break.

-- Adam


On 4/20/06, Andrew Robinson <an...@gmail.com> wrote:
> Although this really brings up the question about if ':' is a wise choice
> for ID separation. Perhaps a new feature should be introduced to JSF to be
> able to set this?
>
> web.xml:
>   <context-param>
>     <param-name> javax.faces.ID_SEPARATOR</param-name>
>     <param-value>-</param-value>
>   </context-param>
>
> If it isn't given, it could default to ':'.
>
> What do you think?
>
> It would also help to be able to get the client ID from the XHTML/JSP.
> Perhaps an EL method of getting the current component or something. That way
> forceId would not be needed.
>
> It would be a large change, but I think it would be nice.
>
> -Andrew
>
>
>
>
> On 4/20/06, Martin Marinschek < martin.marinschek@gmail.com> wrote:
> > Yes,
> >
> > I was told so too- then I went ahead and tried it out in the browsers.
> > Thanks to Microsoft, it doesn't work in IE. Firefox implements it,
> > though.
> >
> > We're back to using forceid.
> >
> > regards,
> >
> > Martin
> >
> > On 4/19/06, Adam Winer <awiner@gmail.com > wrote:
> > > Colin,
> > >
> > > It's not incompatible with CSS;  you just need to use a backslash
> > > to escape it:
> > >
> > >   <style>
> > >     div#foo { background-color:red}
> > >     div#foo\:bar { background-color:green}
> > >   </style>
> > >
> > >   <div id="foo">Foo</div>
> > >   <div id="foo:bar">Foo:Bar</div>
> > >
> > > -- Adam
> > >
> > >
> > >
> > > On 4/19/06, Colin_Sharples@bnz.co.nz <Co...@bnz.co.nz> wrote:
> > > >
> > > > Is it mandated that component ids use colons, e.g. form:comp?
> > > >
> > > > We have had some problems with a CSS that was using id selectors to
> apply
> > > > styles to particular elements. However, colon is not valid in a CSS id
> > > > selector. Is it possible to change the character that JSF uses in ids?
> It
> > > > seems odd that JSF would do something that is incompatible with CSS.
> > > >
> > > > --
> > > > Colin Sharples
> > > >
> > > >
> > > > At Bank of New Zealand, we've got lots of ways to help both you and
> your
> > > > money be better off.
> > > >
> > > >
> > > >
> > > > CAUTION - This message may contain privileged and confidential
> information intended only for the use of the addressee named above. If you
> are not the intended recipient of this message you are hereby notified that
> any use, dissemination, distribution or reproduction of this message is
> prohibited. If you have received this message in error please notify Bank of
> New Zealand immediately. Any views expressed in this message are those of
> the individual sender and may not necessarily reflect the views of Bank of
> New Zealand.
> > > >
> > >
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
>
>

Re: Colons in component ids

Posted by Andrew Robinson <an...@gmail.com>.
Although this really brings up the question about if ':' is a wise choice
for ID separation. Perhaps a new feature should be introduced to JSF to be
able to set this?

web.xml:
  <context-param>
    <param-name>javax.faces.ID_SEPARATOR</param-name>
    <param-value>-</param-value>
  </context-param>

If it isn't given, it could default to ':'.

What do you think?

It would also help to be able to get the client ID from the XHTML/JSP.
Perhaps an EL method of getting the current component or something. That way
forceId would not be needed.

It would be a large change, but I think it would be nice.

-Andrew



On 4/20/06, Martin Marinschek <ma...@gmail.com> wrote:
>
> Yes,
>
> I was told so too- then I went ahead and tried it out in the browsers.
> Thanks to Microsoft, it doesn't work in IE. Firefox implements it,
> though.
>
> We're back to using forceid.
>
> regards,
>
> Martin
>
> On 4/19/06, Adam Winer <aw...@gmail.com> wrote:
> > Colin,
> >
> > It's not incompatible with CSS;  you just need to use a backslash
> > to escape it:
> >
> >   <style>
> >     div#foo { background-color:red}
> >     div#foo\:bar { background-color:green}
> >   </style>
> >
> >   <div id="foo">Foo</div>
> >   <div id="foo:bar">Foo:Bar</div>
> >
> > -- Adam
> >
> >
> >
> > On 4/19/06, Colin_Sharples@bnz.co.nz <Co...@bnz.co.nz> wrote:
> > >
> > > Is it mandated that component ids use colons, e.g. form:comp?
> > >
> > > We have had some problems with a CSS that was using id selectors to
> apply
> > > styles to particular elements. However, colon is not valid in a CSS id
> > > selector. Is it possible to change the character that JSF uses in ids?
> It
> > > seems odd that JSF would do something that is incompatible with CSS.
> > >
> > > --
> > > Colin Sharples
> > >
> > >
> > > At Bank of New Zealand, we've got lots of ways to help both you and
> your
> > > money be better off.
> > >
> > >
> > >
> > > CAUTION - This message may contain privileged and confidential
> information intended only for the use of the addressee named above. If you
> are not the intended recipient of this message you are hereby notified that
> any use, dissemination, distribution or reproduction of this message is
> prohibited. If you have received this message in error please notify Bank of
> New Zealand immediately. Any views expressed in this message are those of
> the individual sender and may not necessarily reflect the views of Bank of
> New Zealand.
> > >
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>

Re: Colons in component ids

Posted by Martin Marinschek <ma...@gmail.com>.
Yes,

I was told so too- then I went ahead and tried it out in the browsers.
Thanks to Microsoft, it doesn't work in IE. Firefox implements it,
though.

We're back to using forceid.

regards,

Martin

On 4/19/06, Adam Winer <aw...@gmail.com> wrote:
> Colin,
>
> It's not incompatible with CSS;  you just need to use a backslash
> to escape it:
>
>   <style>
>     div#foo { background-color:red}
>     div#foo\:bar { background-color:green}
>   </style>
>
>   <div id="foo">Foo</div>
>   <div id="foo:bar">Foo:Bar</div>
>
> -- Adam
>
>
>
> On 4/19/06, Colin_Sharples@bnz.co.nz <Co...@bnz.co.nz> wrote:
> >
> > Is it mandated that component ids use colons, e.g. form:comp?
> >
> > We have had some problems with a CSS that was using id selectors to apply
> > styles to particular elements. However, colon is not valid in a CSS id
> > selector. Is it possible to change the character that JSF uses in ids? It
> > seems odd that JSF would do something that is incompatible with CSS.
> >
> > --
> > Colin Sharples
> >
> >
> > At Bank of New Zealand, we've got lots of ways to help both you and your
> > money be better off.
> >
> >
> >
> > CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify Bank of New Zealand immediately. Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Bank of New Zealand.
> >
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Colons in component ids

Posted by Adam Winer <aw...@gmail.com>.
Colin,

It's not incompatible with CSS;  you just need to use a backslash
to escape it:

  <style>
    div#foo { background-color:red}
    div#foo\:bar { background-color:green}
  </style>

  <div id="foo">Foo</div>
  <div id="foo:bar">Foo:Bar</div>

-- Adam



On 4/19/06, Colin_Sharples@bnz.co.nz <Co...@bnz.co.nz> wrote:
>
> Is it mandated that component ids use colons, e.g. form:comp?
>
> We have had some problems with a CSS that was using id selectors to apply
> styles to particular elements. However, colon is not valid in a CSS id
> selector. Is it possible to change the character that JSF uses in ids? It
> seems odd that JSF would do something that is incompatible with CSS.
>
> --
> Colin Sharples
>
>
> At Bank of New Zealand, we've got lots of ways to help both you and your
> money be better off.
>
>
>
> CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify Bank of New Zealand immediately. Any views expressed in this message are those of the individual sender and may not necessarily reflect the views of Bank of New Zealand.
>