Validate script -- stopped working??

I have a field that is being used in a calculation.  In order to get the calculation right, the numeric value entered must not contain a comma.  Therefore, I want the user to enter 11000 rather than 11,000.

Therefore, I put the following validate script on the field on the lead_Custom screen.

var sqft = Values('lead_bldsqft');
if(sqft > 0){
if (sqft.indexOf(',') != -1) {
Valid = false;
ErrorStr="Please enter building sqft without a comma";

When I first created the script, it was working.  However, it is no longer working and I cannot figure out why.  Is there a service I should check to make sure it is running.

Users are in the system, therefore, I don't really want to reboot the system.

Any assistance would be greatly appreciated!  Thank you!

  • I assume that lead_bldsqft is a text field?  If it was a number then you would not need to worry about commas.  But sqft>0 will only work if the number is entered without a comma.  This is because JavaScript will look at a string e.g "10000" and be able to dynamically treat it as a number.  But if the string looks like "1,000" then it can't as 'comma' is not understandable as part of a number.

  • Thank you!  I will take another look at this and double check the field types.  The odd thing is that this was working as I had it and then it stopped working.  I don't recall changing any of the field types.