문제

I want to restrict my <p:inputMask> with only letters and numbers without giving any size (max-legth) limit. I tried to use mask attribute but when I use mask attriibute it gives a max-length for my inputMask. Could you please help me to solve this issue ?

Sample Code :

<p:inputMask value="#{gercekKrediBasvuruDetayGirisView.kisi.ticariHarfSeri}"
  required="true" mask="***" 
  requiredMessage="#{msg['GercekKrediBasvuruTuketiciMaliBilgiler.belgeSeriNull']}"
/>
도움이 되었습니까?

해결책

If your input does not have to be <p:inputMask> and can be <h:inputText> or <p:inputText> then the easiest way to go would be to use it with regex:

<h:inputText id="inputField" value="#{backingbean.username}" validatorMessage="Value does not match pattern.">
        <f:validateRegex pattern="^[a-zA-Z0-9]+$" />
</h:inputText>
<h:message for="inputField" />

If you only allow lower case letters go with ^[a-z0-9]+$. <p:inputMask> is designed for somewhat stricter validation than only letters and numbers.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top