PDA

View Full Version : Ext Js Numeric and hyphen



oneofthelions
10 Feb 2011, 4:38 AM
Hi, I was using TextField of the form. I also want to allow Hyphen. I need help in calling a regular expression which does a check that no alphabets and only numbers allowed and one hyphen as well.




var issueNoField = new Ext.form.TextField({ // "-" a hyphen is allowed
fieldLabel:'Issue No',
width: 120,


});

// Like xxxx-xxx


Now I want to call a regular expression funtion to check that a hyphen is entered in the middle



function check(issueNo Field){ //This function is to be called when something entered
var chk= /^[0-9]+-[0-9]{1,2}$/;
}