How to restrict an input to a variable amount of numbers only with PrimeFaces inputMask element

后端 未结 5 2482
Happy的楠姐
Happy的楠姐 2021-02-20 05:35

I need to define something similar to this regex:

[0-9]{1, 5}

On a PrimeFaces element:



        
5条回答
  •  心在旅途
    2021-02-20 05:59

    If you want or need to limit the length too, you could do something like this:

    
    

    where the user can only enter 1 to 5 digits, or the following for four digits and so on

    
    

    Prior to PrimeFaces 5.1: use placeHolder instead of slotChar (Issue 7324).

提交回复
热议问题