Hi All - I am a JSF newbie. I have a datatable form with each row containing a drop-down selectonemenu and a inputtextbox. I would like to use javascript (or anything!) to have the drop-down populate the textbox. I wanted to assign the id's of the components using the rowindex of the datamodel for the datatable but id won't let me. What am I missing? Thanks!
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
JSF already does it. You don´t need to do it. Just assign a fixed ID to h:form, h:dataTable, h:anyInputComponent and -if any- the f:subview so that JSF won´t autogenerate ID´s for you so that you have consistent element ID´s in the generated HTML output at end.
Thanks but won't I have a table full of drop-down with the same id if I assign an id once in the datatable and it iterates over a datamodel? How can I reference it in the Javascrpit?
I apologize for my ignorance!! Thank you so much!!
Yvette Gonzalez
Greenhorn
Joined: Jan 14, 2002
Posts: 9
posted
0
By the way - your blog is wonderful and a lifesaver!! I was hoping you would reply! Thanks!
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
Check the generated HTML output, make use of the 'this' reference in Javascript and a shot of logical thinking
Example:
Yvette Gonzalez
Greenhorn
Joined: Jan 14, 2002
Posts: 9
posted
0
Thanks Bauke! I took a shot of logical thinking and now all is working!
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
You´re welcome.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.