nr.iras.sk
nr.iras.sk

Reputation: 8498

Exclude dot(.) from extjs number field

I have one extjs number field. I can enter numbers 0-9 and dot(.) in it. How can I avoid this dot also. I need only integers. Plase give me the required regex.

Upvotes: 4

Views: 2907

Answers (2)

dougajmcdonald
dougajmcdonald

Reputation: 20047

There is actually a config property on a numberfield to do that, so you can just specify the field like this:

{
    xtype: 'numberfield',
    allowDecimals: false
}

Upvotes: 8

user938787
user938787

Reputation:

/^\d+$/ is the regex you requested.

If you need to capture it, try /^(\d+)$/

Upvotes: 2

Related Questions