Hi,
I have a text field it should allow only Number, only one time 'Q' and 'C'. I created below mentioned code.
<input type="text" name="vcno" onkeypress="return blockChars([^0-9-Qq-Cc])">
function blockChars(Chars){
var status = false;
if(Chars.indexOf('\\') != -1)
status=true;
varKeyCode = getKeyCode() ;
if(KeyCode != undefined && isEmptyValue(Chars) ){
var g = String.fromCharCode(KeyCode);
if(g.match(spChars))
return false;
else if(g == '+')
return false;
else if(status && g == '\\')
return false;
else
return true;
}
}
From this code, my text field allows many No. of times 'Q' and 'C'. Is any regular expression available for my fullfill condition?
sasikrishnasamy 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.