I'm loving the jsf 2.0 composite component setup. One other thing I love is prependId="false" on forms. Is there an equivalent that can be defined in cc:interface or cc:implementation that will prevent jsf from creating a j_id to prepend to the ids defined within the composite component?
Remove auto generated j_id from composite components
Asked Answered
Your question give me the answer: tks for prependId="false" tip –
Canea
That's not possible. Just give the component a fixed id
instead letting JSF autogenerate one. The same applies on forms by the way. This way you can still select them using CSS selectors.
Or better, just give them a styleClass
so that you don't need to select by ID, for the case that this aversion was actually caused by inability to select components/elements by client ID (I don't see other feasible reasons).
that will work. I get all the html from the creative department and it would be nice to be able to use their ids as delivered but I bet they'll change them up for future projects if I let them know the format. –
Coronel
Note that the default JSF separator
:
is illegal in CSS. You'd have to escape them as \3A
(with space behind). In JSF 2.0 you can however configure it as javax.faces.SEPARATOR_CHAR
context param in web.xml
. Use for example -
(and ensure that you don't use it elsewhere in fixed ids). –
Words very cool. we have style sheets full of \3A so it would be nice to replace those. –
Coronel
Very true, but just as a reference: when using jQuery one can select the default colons by escaping them, like
$("#some\\:id").focus();
for <input id="some:id">
. –
Wamsley @Arjan: or
$("[id='some:id']")
. See also #7928216 –
Words © 2022 - 2024 — McMap. All rights reserved.