hi friends,
i doing a validation on client side to insert a values.
the javascript script validation code are
but my problem is , i can not validated length of the string and to check numeric or alphabetic for currency and name and age
i used following snippets of code check the data are characters are not
but its not working for me.
can anyone tell me what mistake i have done in this code.
thanks in advance
S.Rajkumar
i doing a validation on client side to insert a values.
the javascript script validation code are
function
validate() {
if
(document.getElementById(
"<%=rcmbcurrencycode.ClientID%>"
).value ==
"Select"
) {
alert(
"Currency Code can not be blank"
);
return
false
;
}
if
(document.getElementById(
"<%=rtxtinteresttype.ClientID%>"
).value ==
""
) {
alert(
"Interest Type can not be blank"
);
return
false
;
}
}
but my problem is , i can not validated length of the string and to check numeric or alphabetic for currency and name and age
i used following snippets of code check the data are characters are not
var
alphaExp = /^[a-zA-Z]+$/;
if
(document.getElementById(
"<%=rtxtinteresttype.ClientID%>"
).value ==
""
) {
alert(
"Interest Type can not be blank"
);
return
false
;
if
(rtxtinteresttype.value.match(alphaExp)) {
return
true
;
}
else
{
alert(
"pls enter only numbers"
);
return
false
;
}
}
but its not working for me.
can anyone tell me what mistake i have done in this code.
thanks in advance
S.Rajkumar