How to limit the number of characters in an inputNumber?

Asked

Viewed 512 times

1

I’m using the Primefaces extension to format a input the weight and height of a person and could not. How do I limit the amount of characters typed in input?

I tested with maxlength="5" but it didn’t work:

<pe:inputNumber 
  id="peso" 
  maxlength="5"
  label="Peso" 
  value="#{pessoaBean.pessoaCaracFisica.peso}"/>

1 answer

2

Just use the attribute maxValue.

    <pe:inputNumber id="peso" maxlength="5" label="Peso" 
     maxValue="200" value="#{pessoaBean.pessoaCaracFisica.peso}"/>

In the example code above, the largest number it will allow to be typed is 200.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.