0

I have some rangesliders like:

<h:form>    
        <input name="range1" id="range1" min="0" max="5" value="#{prefProfileBean.pref1}" type="range"/>
        <input name="range2" id="range2" min="0" max="5" value="#{prefProfileBean.pref2}" type="range" />
...

<p:commandButton value="Profil speichern" onclick="PF('updprofile').show();" action="#{prefProfileBean.submit}" />

in View the value of the sliders is updated, but as i press submit button the values are not written, instead the values stay the same as they was initially. that way i cant change and save the values in database.

can i use the onchange action somehow to override the initial values with the shown changed ones...

can someone tell me how to get the actual chosen value out of this components?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • HTML 5 (`type="range"`). – Tiny Jun 02 '15 at 15:49
  • Try the [slider](http://www.primefaces.org/showcase/ui/input/slider.xhtml) component. I don't think plain HTML tags handle bindings. – Diego Jun 02 '15 at 15:57
  • Look here: http://docs.oracle.com/javaee/7/api/javax/faces/view/facelets/TagDecorator.html – Kukeltje Jun 02 '15 at 16:08
  • @Diego, your comment made me think of this [blog post](http://blog.primefaces.org/?p=3035). I don't know how it works, and I've never tried it, but the author sets `jsf:value="#{userView.user.firstname}"` on an `input` element. I don't think it will help OP, just thought you'd be interested. – DavidS Jun 02 '15 at 16:09
  • @Diego: not in this way, but with html5 friendly markup they do – Kukeltje Jun 02 '15 at 16:09
  • @DavidS interesting, I'm still working with an old JSF version and never seen this way of writing views :) – Diego Jun 02 '15 at 16:21
  • @diego: it has only advantages if you want to combine jsf with javascript ui frameworks – Kukeltje Jun 02 '15 at 20:39
  • You need JSF-2.2, with which you can blend HTML5 markup with JSF value bindings. Without that you'll have to do more than a little more work to save the bindings – kolossus Jun 03 '15 at 03:40

0 Answers0