Page 1 of 1

p:spinner only step - no manuell input

Posted: 27 Apr 2011, 16:38
by jsfRocks
Hello,

Is it possible to force using only the up and down buttons of the p:spinner component?
I want to ensure that the value is only from start value (min) up to n-times the step e.g. min=0 max=30 step=10 only 0,10,20,30 should be accepted with no change of manuell input of the user via the textfield.

I know that I could use a validator but I even don't want to give the change to try a non valid input.

Re: p:spinner only step - no manuell input

Posted: 27 Apr 2011, 17:32
by aliirawan
Try these :)

Code: Select all

<p:spinner value="0" onkeydown="return false;"/>
you can replace the value into the backing bean method

Code: Select all

<p:spinner value="#{myBean.data}" onkeydown="return false;"/>

Re: p:spinner only step - no manuell input

Posted: 28 Apr 2011, 08:12
by jsfRocks
:) Thanks

(in my opinion this should be an extra property for the component - this isn't very intuitive)

Re: p:spinner only step - no manuell input

Posted: 02 May 2011, 13:25
by aliirawan
Yeah maybe should add a new attribute such as

<p:spinner value="#{myBean.data} typeable="false" />

or something.