You found a bug! We've classified it as TOUCH-5297 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext JS Premium Member meditecsports's Avatar
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    47
    Vote Rating
    2
    meditecsports is on a distinguished road

      0  

    Default Ext.data.Validation.length and the new Ext.data.Field.defaultValue

    Ext.data.Validation.length and the new Ext.data.Field.defaultValue


    Sencha Touch 2.3.0

    In ExtJs the Ext.data.Field.defaultValue defaults to ""; in Sencha Touch this has been changed to undefined.

    I think, this should be recognized, when a length validation occurs. In ExtJS & Touch the length validation rejects undefined and null values as false (i.e. not valid). However with the changed defaultValue in Sencha Touch, this means all fields of a fresh created (and thus empty) record will not pass through a length validation.

    The actual function Ext.data.Validation.length currently starts with:
    Code:
    length: function(config, value) {
                    if (value === undefined || value === null) {
                        return false;
                    }
       ...
    I had to change this to
    Code:
    length: function(config, value) {
                    if (value === undefined || value === null) {
                        return true; // due to a changed Ext.data.Field.defaultValue (is now undefined)
                    }
       ...
    to make it work for me.

    ...and this makes actually more sense to me: If you don't know what length a field has, then you should assume it to be ok.

    Note: To check the presence, you got another method: presence

  2. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,977
    Vote Rating
    132
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

Thread Participants: 1