Hi All,
I was trying onBlur javascript function in
struts framework n it is giving an error. my sample coding is below please advise me whatz wrong in my coding.
Thanks
Regards
Jowsaki
function validate()
{
var valid="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstvwxyz1234567890";
var ok = "yes";
var temp;
var field = window.document.contentForm.custID;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if(valid.indexOf(temp) == "-1") ok = "no";
}
if(ok == "no") {
alert("Invalid entry !!! Only characters and numbers are accepted !");
field.focus();
field.select();
}
<tr>
<td width="20%"><div align="right"><strong>Cust ID:</strong></div></td>
<td width="30%"><div align="left"><html:text property="custID" style="width=220" onBlur="validate(this)"/></div></td>
<td width="20%"><div align="right"><strong>User Keyword:</strong></div></td>
<td width="30%"><div align="left"><html:text property="userID" style="width=220" onBlur="validate(this)" /></div></td>
</tr>