smart gwt allow only numbers in textfield

smart gwt allow only numbers in textfield
Aceptar solo numeros en un textfield en gwt smartclient


very simple MASK PROPERTY

  1.         TextItem phoneNumberField = new TextItem("phoneNo""Phone No.");  
  2.         phoneNumberField.setMask("(###) ###-####");  
  3.         phoneNumberField.setHint("<nobr>(###) ###-####</nobr>");
        final TextItem check4 = new TextItem();
        check4.setName("4");
        check4.setTitle("  Grupo");
        check4.setTitleOrientation(TitleOrientation.TOP);
        check4.setWidth(100);       
        check4.setValue(false);
        check4.setMask("###");


smart gwt allow only numbers in textfield
Aceptar solo numeros en un textfield en gwt smartclient

 
void com.smartgwt.client.widgets.form.fields.TextItem.setMask(String mask)


Input mask used to filter text entry.
Sample masks:
  • Phone number: (###) ###-####
  • Social Security number: ###-##-####
  • First name: >?<??????????
  • Date: ##/##/####
  • State: >LL
Overview of available mask characters
Character Description
0 Digit (0 through 9) or plus [+] or minus [-] signs
9 Digit or space
# Digit
L Letter (A through Z)
? Letter (A through Z) or space
A Letter or digit
a Letter or digit
C Any character or space
 
< Causes all characters that follow to be converted to lowercase
> Causes all characters that follow to be converted to uppercase

Any character not matching one of the above mask characters or that is escaped with a backslash (\) is considered to be a literal.
Custom mask characters can be defined by standard regular expression character set or range. For example, a hexadecimal color code mask could be:
  • Color: \#>[0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]
Note: input mask cannot be used at the same time as a keyPressFilter. Set the mask for this item.
Note that the current value of the field is cleared when changing the mask.
Note : This is an advanced setting
Parameters:
mask mask to apply to text item. Default value is null
See Also:
Text - Masked Example

Comments

Popular posts from this blog

how to access the DOM gwt smartclient