Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Access inputNumberSlider on client  RSS feed

 
Georgian Micsa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I could not find a way to modify the value of a inputNumberSlider on the client using Javascript. Any suggestion?

Thanks
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javascript runs at the client machine. JSF runs at the server machine. You cannot base Javascript on the JSF code. The only what Javascript can see is the HTML DOM tree at the client machine. So, request the JSF page in your favourite webbrowser and do a 'view source' to check its generated HTML output. Now base your Javascript code on that.
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
inputNumberSlider isn't part of core JSF. So the answer to that question will depend on whose JSF tag set you're getting the inputNumberSlider control from.
 
Georgian Micsa
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is the inputNumberSlider from Jboss Richfaces. It looks like on client an anonymous Richfaces.Slider javascript object is instantiated. I cannot access this object to modify the sliderValue property. So if you have experienced the same problem or have a solution how to change the value of this inputNumberSlider using JavaScript please let me know.

Thanks
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I repeat, forget about JSF at all. Open the page in your webbrowser and do a 'view source'. All you see is a piece of HTML. That's also the only what Javascript can see.

If you're new to HTML/Javascript as well, I recommend you to go through some basic HTML/Javascript tutorials. There are nice ones at w3schools.com (including the important HTML DOM tutorial).
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The value= attribute on the inputNumberSlider tag defines the slider value. You have to modify that. Since normally that's going to be a reference to a backing bean property, you would need to fire off a javascript event that does an AJAX modification of that property (and reRender of the slider) in order to ensure that data integrity is maintained between client and server.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!