HTML Area highlighted

We are writing the validation for long edit box which is placed besides the highlighted box.

Please paste below code in HTML Area object on level 0 of PeopleSoft page as highlighted. This object will reflect current count. Example above shows validation for 250 characters. Below code will work only for level zero elements/fields.

<input readonly type=”text” id=”countChar” name=”counter_field1″ size=”3″ maxlength=”3″ value=”100″>

function CharCounter()
if (document.getElementById(“LVL0PSRECORD_PSFIELD“).value.length > 100)
document.getElementById(“LVL0PSRECORD_PSFIELD“).value = document.getElementById(“LVL0PSRECORD_PSFIELD“).value.substring(0, 100);
document.getElementById(“countChar”).value = 100 – document.getElementById(“LVL0PSRECORD_PSFIELD“).value.length;
function addEvent(obj, evType, fn, useCapture){
if (obj.addEventListener){
obj.addEventListener(evType, fn, useCapture);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent(“on”+evType, fn);
return r;
} else {
alert(“Handler could not be attached”);
addEvent(document.getElementById(“LVL0PSRECORD_PSFIELD“), “keyup”, CharCounter, false);