Manage Learn to apply best practices and optimize your operations.

Remove all commas and validate to a usable float/integer

Get rid of commas and then validate the field to make sure it contains all usable positive numbers.

Since Javascript doesn't like to add on commas (wink), get rid of them and then validate the field to make sure it contains all usable positive numbers.

If a non-usable number is found, it redirects you back to the field, selects the fields contents for you and turns the field background to yellow. When it is corrected, the field background will turn back to white (onBlur). These colors are, of course, changeable.

Enjoy, -Mike

Step 1: Paste this into your JS header:

function IsInt (string)
	{if(string == 0) 
	  var val = parseFloat (string);
	  return val > -1
	  var val1 = string / 1;
	  var val = parseFloat(val1);
	  return val > -1

Step 2: Paste this into your fields onBlur event:

var f = document.forms[0];

//remove all commas in a number
newString = this.value.replace(/,/g , "" ); 
this.value = newString;

//Test for usable value
if( !IsInt(this.value)) {alert( "This field contains a value that is negative 
or is not an integer or decimal." ) ; 
this.focus() ;'yellow'} 
if( IsInt(this.value))  {'white'} ;

Step 3: Paste the following into the onFocus field event:


Dig Deeper on Lotus Notes Domino Administration Tools



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...