aspose file tools*
The moose likes JSF and the fly likes Setting the cliendID of an h:inputText Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Setting the cliendID of an h:inputText" Watch "Setting the cliendID of an h:inputText" New topic
Author

Setting the cliendID of an h:inputText

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,
I would like for my rendered <input> tag to have the "name" attribute explicitly set to some value for example: "email" without any colon of course.
I understand the clientID is rendered as the "name" attribute. My question is then: how do I set the clientID of my inputText (preferably from the facelets code)?
Thanks in advance for your help,
Julien.
Victor Hugo M Machado
Greenhorn

Joined: Jan 11, 2011
Posts: 22

maybe I misunderstood what you said but let it ..

the colon are caused because you have separeted the formID from the componentID.

for me.. it ´s possible only if you decompile jsf and change naming components..
Cesar Loachamin
Ranch Hand

Joined: Dec 25, 2010
Posts: 90

Hi Julien

The name of the component is composed for the form_name:component_name, if for some reason this does not work for you, you can remove the form name and the colon setting the prependId attribute of the form to false like this:

Regards

Cesar


When a dream is ending because to come true - OCPJP 6,7. OCE JPA EE6. MCTS
Victor Hugo M Machado
Greenhorn

Joined: Jan 11, 2011
Posts: 22

really good.. one more lesson
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15626
    
  15

The internal name (seen by JavaScript) of a JSF component ID is always going to contain those colons and higher-level qualifiers.

That's because certain JSF components act as naming containers which simply means that IDs within the naming container - for example, the form - must be unique, but the ID itself does not need to be unique globally in the view. JSF knows how to find the appropriate component using a simple ID, but JavaScript (client-side code) doesn't, which is why JavaScript must reference the fully-qualified ID, which includes the IDs of its surrounding naming container(s).


Customer surveys are for companies who didn't pay proper attention to begin with.
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Thank you all for your replies.
Julien.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting the cliendID of an h:inputText
 
Similar Threads
JMS Durable Subscriber Example
duplicate id's in a4j:support
html:hidden tag problem
html:options throws an exception, help please!
How to display text using outputText conditionally in the DataTable