This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Apologies if you've already considered this, but you may be making life difficult for yourself. Why not use one of the JSF Date Picker controls, such as Tomahawk InputDate/Input Calendar or RichFaces Calendar?
Two possible solutions that I can think of: 1. Declare the id's of the form and the component during compile time, i.e. assign an id for the form and component and embed the expected id in the js function.
Cons - Not scalable when you have multiple components using the same jsfunction
2. Implement a custom component that will dynamically embed the jsfunction during the render phase because you can get the formId and the componentId in the FacesContext instance
I hope this helps your problem.
Uy Jerwin Louise Vergara
Junior Developer / Research and Development at Incuventure Partners Corporation
Joined: Aug 03, 2008
Thanks for the response. I'll try the RichFaces first. It looks very good.
Joined: Aug 03, 2008
I have assigned an unique ID to the h:form and use document.getElementById() in JS. It works well.
I have a similar requirement , can this requirement be achieved only with generic facets? could you please let me know how you have achieved this requirement?
Thanks a ton in advance.
OCJP1.6, OCA 9i , IBM SOA Certified
Jerwin Louise Uy
Joined: Oct 27, 2007
I don't quite understand your question. ~_~
If you need to know the client id of a certain component during runtime, then I am afraid that feat is left to the NamingContainer of JSF.
Of course, you can tell the NamingContainer not to assign a unique identifier to your components if the id attribute has a value. Note that having two components reference the same id will cause your page not to function. (If I can remember, it will throw an error telling you that it found a Duplicate id in the UIViewRoot)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com