Field Size Limit - Working Code - Error in compling JavaScript periodically

Hi,

Firstly aplogises, as I’ve cross-posted this in the R6 forum as well. But have since discovered the R8.5 client also produces the error.

I’ve got some JavaScript based code that I’ve been playing with in order to limit the number of characters that can be inputted into a field. This works fine. I can’t take any credit for the JavaScript code as it was taken from numerous sources.

However, if the form is idle for about 10 minutes then the Notes Client will display a JavaScript Error. The error is “Error in compiling JavaScript”. The only way to remove the error message is to select “Skip executing JavaScript on this page” and “Don’t show any more JavaScript errors on this page”. Obviously at this point the code stops working.

A similar question has been raised previously in the R6/7 forum - see http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllFlatWeb/a78a3875374c10a885257310000b355a?OpenDocument . Someone did reply with a link to an IBM document which has since been removed, or the link changed.

Can anyone assist me with this error please?.

The code for reference is:

FORM: JS HEADER (Client / JavaScript)

/Word and Character Counter****************/

var submitcount=0;

function checkSubmit() {

if (submitcount == 0)

{

submitcount++;

document.Surv.submit();

}

}

function textCounterField(field, countfield, maxlimit) {

if (field.value.length > maxlimit)

{field.value = field.value.substring(0, maxlimit);}

else

{countfield.value = maxlimit - field.value.length;}

}

/END COUNTER********/

You then need two fields. One to act as the counter, and then other which you will actually enter data into.

COUNTER FIELD: This should be a text field, set to Computed. For the purpose of the example you should call the field tmpCount The default value in my setup is the field itself - ie tmpCount.

INPUT FIELD: In my example this is a text field, which is set to Editable. For the purpose the example you should call the field Field1. This field has some code against it:

ONBLUR (Client / JavaScript)

window.clearInterval(useClick);

ONFOCUS (Client / JavaScript)

if(typeof(useClick) !== ‘undefined’)

{

window.clearInterval(useClick);

}

useClick = window.setInterval(“textCounterField(document.forms[0].Field1,document.forms[0].tmpCount,38)”,100);

Note in the above line of code the reference to the field names. The field is limited to 10 characters. This is determined by the ,10 after the reference to the tmpCount field.

Thank you

Iain Chapman.