Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help in a JSP page and a Java script

 
anwaradil adil
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,

I am struck with the script , I have to hide/mask SSN(a number or string) .I should only be displaying last four digits of that number.

<html:text property="ssn1" styleClass="clsForm" maxlength="3" size="3" uppercase="true" onkeyup="javascript:autoTab(this, 3, event);if(value.length==2){ssn2.focus();mask(this)}"/> 


please note its not a <input> tag its <html:text> and the value is displayed from database we are not entering it and value is read only.I want to know If I am calling mask(this) from correct place. I do not see any thing reflected on the page even after I have written the following java script

java script

function mask(obj) {
var a=’’;
var len = obj.value.length;
for(var i=0,;i<len;i++) {
a += "x";
}

obj.value = a;
}
can somebody correct this java script . if numbers are like 123456789 then i should display them as *****6789 (only last four visible)

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic