Results 1 to 2 of 2

Thread: problem with integer fields and negative values

  1. #1
    pxpsoftware is offline Junior Member
    Join Date
    Aug 2006
    Posts
    2

    Default problem with integer fields and negative values

    hi,

    in the accounts module we added an integer field.
    but when entering a negative number we get the error message "Invalid Value"!?
    what do we need to do to allow negative numbers?
    hope someone can help.

    thanks.

  2. #2
    aschaeffer is offline Sugar Community Member
    Join Date
    Oct 2006
    Location
    Vienna, Austria
    Posts
    35

    Lightbulb Re: problem with integer fields and negative values

    Hi,

    I had the same and it took me some time but here's the answer:

    Got to include/javascript/sugar_3.js

    on line 363 replace:

    function isFloat(floatStr) {
    if(floatStr.length== 0) {
    return true;
    }
    floatStr = unformatNumber(floatStr, num_grp_sep, dec_sep).toString();

    if(!/^[0-9\.]+$/.test(floatStr))
    return false
    return true
    }

    with

    function isFloat(floatStr) {
    if(floatStr.length== 0) {
    return true;
    }
    floatStr = unformatNumber(floatStr, num_grp_sep, dec_sep).toString();

    if(!/^[-0-9\.]+$/.test(floatStr))
    return false
    return true
    }

    Basically Ijust added a "-" before "0-9" and that's it!

    Hope this will help someone,

    Cheers

    Alan
    Alexandre Schaeffer
    Business Development
    enalog business solutions GmbH
    Mahlerstraße 7/22, A-1010 Wien
    www.scanpoint.at, www.enalog.com
    mailto: aschaeffer@enalog.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •