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
	  }
	 else 
	  {
	  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() ; this.style.backgroundColor='yellow'} 
if( IsInt(this.value))  {this.style.backgroundColor='white'} ;
	

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

select()

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchDataCenter

SearchContentManagement

Close