Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Float validator

    I'm using smartgwt 2.1.0 and FF.

    I want to to validate float values but the default DataSourceFloatFieldField doesn't allow to validate comma separated numbers like: 13,5. I was reading in the forum and I found one way is to define new type. Like this one:

    Code:
       public EuropeanFloatType() {
                super("EuropeanFloatType", FieldType.TEXT);
    
                RegExpValidator validator = new RegExpValidator("^[-+]?\\d+(\\,\\d+)?$");
                validator.setErrorMessage("Valor no válido");
                setValidators(validator);
    
    
            }
    The problem is that I send to the database an incorrect number and doesn't save my value.

    Is some way to redefine number formmating (comma instead point as separator), or replace the value of datasoucefield before to send to my database?

    Thanks in advance

    #2
    There have been several posts about the european floats. You may find a solution in this one :

    http://forums.smartclient.com/showthread.php?t=2039

    Comment

    Working...
    X