Why does this javascript works in Notes 5 but not in Notes 6

Hi,

I have this codes so that user cannot enter more than 300 characters in a text field. It was working fine in Notes 5 until we upgrade to Notes 6. I am not sure what’s wrong with it.

Here are my codes in js onload:

var fName300 = “”

var nLen300 = 0

function limitField300( f, n){

// Transfer local variables to globals

fName300 = f;

nLen300 = n;

limitLength300();

}

Function limitLength300(){

if (fName300 != “” && nLen300 > 0){

with (document.forms[0].elements[fName300]){

v = value

if (v.length > nLen300) {

   value = v.substr(0,nLen300)

   

alert ("You can enter only upto 300 characters in this fields")

}else{

value = v

}

timerID = setTimeout(“limitLength300()”, 10000);

}

}

}

On focus of the field I have this codes:

limitField300(this.name, 300)

On Blur of field:

clearTimeout(timerID)

Thanks for any help.

Michelle

Subject: Why does this javascript works in Notes 5 but not in Notes 6

Michelle,

If you are using this on the web, do you see any script errors when you load the page?

Shawn

Subject: Works now

Hi Shawn,

I got the codes from Lawrence A Broy and it works

function limitLength300(){

if (fName300 != “” && nLen300 > 0){

with (document.forms[0].elements[fName300]){

v = value

if (v.length > nLen300) {

   value = v.substr(0,nLen300)

   

alert ("You can enter only upto 300 characters in this fields")

}else{

value = v

}

timerID = setTimeout(“limitLength300()”, 10000);

}

}

}

Subject: RE: Works now

It works now, or it used to work and you still need help?

Shawn