0

JSF 2.2 Primefaces 6.0

The "emptyValue" attribute of p:inputNumber seems straightforward, and yet it is not working

   <p:inputNumber id="wsMaxInput" emptyValue="empty"
      value="#{officeResults.wsCountMax}" maxValue="3000"
      minValue="0" styleClass="ondInput" />

Not only does it not look empty (I'm not sure if picture attaching will work from here), but when I hit "submit" the value is set to zero when it should be null.

enter image description here

What am I missing about this component?

april26
  • 833
  • 3
  • 14
  • 27
  • The problem might be with `minValue="0"` because it will be resetting value to `0`! – Parkash Kumar May 05 '17 at 13:21
  • Check your backingbean... is the `#{officeResults.wsCountMax}` an int? I am 99.9% sure it is: https://www.google.nl/search?q=jsf+default+value+int+stackoverflow – Kukeltje May 05 '17 at 13:30
  • Possible duplicate of [How to make number input area initially empty instead of 0 or 0.00?](http://stackoverflow.com/questions/14334188/how-to-make-number-input-area-initially-empty-instead-of-0-or-0-00) – Kukeltje May 05 '17 at 13:31
  • OfficeResults.java: "private Integer wsCountMax". When I remove minValue="0" it populates with "0.00" . So neither of these comments apply. I'll keep digging. – april26 May 05 '17 at 14:22
  • In fact, when I have 2 components side-by-side wsCountMin and wsCountMax and I have one emptyValue="zero" and one emptyValue="empty" they are both populated identically with "0.00" – april26 May 05 '17 at 14:28
  • I just found the bug - my bug. I had registered a converter when I declared wscountmin as a viewParam at the top of the page. The converter was causing this. I forgot all about it and just saw it. I removed the converter and got the desired result. – april26 May 05 '17 at 14:33

0 Answers0