I am using ExtJs NumberField. Itβs good that he checks that only numbers are entered. But I also want a hyphen. How can I go to javascript editing
var <portlet:namespace/>issueNoField = new Ext.form.NumberField({ //This takes only numbers fieldLabel: 'Issue No', width: 120, displayField: 'Enter no', valueField:'IssNo' });
var <portlet:namespace/>issueNoField = new Ext.form.TextField({ //This takes only numbers fieldLabel: 'Issue No', width: 120, regex: /[1-9-]*/ });
Use the "baseChars" option.
var <portlet:namespace/>issueNoField = new Ext.form.NumberField({ //This takes only numbers fieldLabel: 'Issue No', width: 120, displayField: 'Enter no', valueField:'IssNo' baseChars: "0123456789-" });
Fiddle
maskRe
maskRe: /^[0-9 -]$/
, (99999-9999)? , .
, "12-345" "123-45" , , . .
Regex , :
maskRe: /[1-9-]/,
{ xtype: 'textfield', mask: '(999) 999-9999' }
, , text field , .
text field
.
:
'9999999999' '999-999-9999'
allowExponential false. , 'e+-' decimalSeparator .
allowExponential
'e+-'
decimalSeparator
. .