How to restrict Primefaces inputMask to numbers only?

后端 未结 1 513
长情又很酷
长情又很酷 2021-02-14 01:59

I want to restrict p:inputMask to numbers only, and I tried the proposed solutions from:

  • How to restrict an input to numbers only wit
1条回答
  •  礼貌的吻别
    2021-02-14 02:31

    I think that approach is right but I noticed that you don't put value attribute on inputMask. Do you try to put it on?

    Edit: These solutions works:

    inputMaskTest.xhtml:

    Input Mask:

    InputMaskView.java:

    @ManagedBean(name = "inputMaskView")
    @ViewScoped 
    public class InputMaskView {
      private String number;
    
      public String getNumber() {
        return number;
      }
      public void setNumber(String number) {
        this.number = number;
      }
    }
    
    • see also: http://forum.primefaces.org/viewtopic.php?f=3&t=37665

    0 讨论(0)
提交回复
热议问题