• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting "rendered" attribute via javascript?

 
Leo Budima
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to enable a user to click a link and as a result show couple of JSF components on the same page without reloading. Is this possible using javascript and altering rendered attribute and what would be the syntax?

Thanks!
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

take a look at Ajax http://www.getahead.ltd.uk/dwr/ it may help you.

regards.
 
Leo Budima
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know of DWR and it's great - this solution has crossed my mind, but is an overkill since I just need to show some hidden components that are allready on the page, and I think this must be possible via client-side scripting, but am to new to JSF to know exactly how
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Leo Budima:
I know of DWR and it's great - this solution has crossed my mind, but is an overkill since I just need to show some hidden components that are allready on the page, and I think this must be possible via client-side scripting, but am to new to JSF to know exactly how


Only one way of I know to just use Javascript to do this. You'd need to put your components in a div and set the div's visible style to hidden. Then use javascript to change that divs style attribute when you want them to show.

Other than that you'll need a trip to the server.
 
Leo Budima
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I wonder why I haven't thought of that But, generally, is it possible to reference JSF component in javascript?

Since JSF renders regular HTML with id attributes, is it possible to access component attributes with something like:


?
 
Leo Budima
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. Assuming of course that I have fixed set of components on a page and I know what will be the id of a component I need when it's rendered
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!