Textfield allow numbers only

for example I have field as count and count field should allow numbers to enter.

If we use Maskfield it will work but without using maskfield how to do

Hi,

Set the datatype for the field.

I use Datatype like this

@Named("fieldGroup.name")
protected TextField name;

@Override
public void init(Map<String, Object> params) {
    name.setDatatype(Datatypes.get(Integer.class));
}

but it is not working