• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting the cliendID of an h:inputText

 
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 22
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Ranch Hand
Posts: 90
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Victor Hugo M Machado
Greenhorn
Posts: 22
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
really good.. one more lesson
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for your replies.
Julien.
 
reply
    Bookmark Topic Watch Topic
  • New Topic