views:

280

answers:

2
+3  Q: 

Read only spinner

I am learning Jsf.Is there any method for making the spinners read only?I should change the value only using spinners and not directly typing the number.Can i implement that by setting attribute in the spinners.tld file?

+3  A: 

Disabling the textfield part of a spinner control is a usability disaster. Please don’t do it. Some of us really want to enter the number.

Bombe
That's not really an answer to the question ...
Guillaume
+1 I agree with Bombe. I nearly always use the textbox part as the buttons are usually so small they're difficult to hit, and if I want to enter 20 (or more), I don't want to have to click 19 times!Sometimes the answer is to rethink the approach.. :o)
Andrew
+1  A: 

With JSF2.0, you could write your own spinner JSF component except that, instead of using:

 <h:inputText id="number" value="#{compositeComponent.attrs.value}"/>

(which is a read-write input box ), you could use a outputLabel:

<h:outputLabel for="number" value="#{compositeComponent.attrs.value}"/>

, hence achieving exactly what you are after.

Note, an outputText could be as effective.

JSF2.0 is released in PR (Public Review) mode.
It is worth looking into because one of the "pain points" for JSF has always been the complexity that you face in creating components. In JSF 2.0, creating a new component that's made up of existing components is a snap.

VonC