p:spinner only step - no manuell input

UI Components for JSF
Post Reply
jsfRocks
Posts: 7
Joined: 19 Apr 2011, 19:55
Location: Germany

27 Apr 2011, 16:38

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.
Regards
jsfRrocks
---
Primefaces 2.2.1 / JSF 2 / JBoss 6

aliirawan
Posts: 26
Joined: 15 Nov 2010, 20:09
Location: Jakarta, Indonesia
Contact:

27 Apr 2011, 17:32

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;"/>
I like to explore new things. There's a way for everything. I believe.

jsfRocks
Posts: 7
Joined: 19 Apr 2011, 19:55
Location: Germany

28 Apr 2011, 08:12

:) Thanks

(in my opinion this should be an extra property for the component - this isn't very intuitive)
Regards
jsfRrocks
---
Primefaces 2.2.1 / JSF 2 / JBoss 6

aliirawan
Posts: 26
Joined: 15 Nov 2010, 20:09
Location: Jakarta, Indonesia
Contact:

02 May 2011, 13:25

Yeah maybe should add a new attribute such as

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

or something.
I like to explore new things. There's a way for everything. I believe.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests