Results 1 to 5 of 5

Thread: Data Model Validations: Format Validation

    You found a bug! We've classified it as DSGNR-1120 . 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 Artistan's Avatar
    Join Date
    Apr 2007
    Location
    MN
    Posts
    144
    Vote Rating
    0
      0  

    Default Data Model Validations: Format Validation

    Does not have a Property for matcher regex.

  2. #2
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,487
    Vote Rating
    145
      0  

    Default

    Please post a code snippet of what you are looking to define in the Designer that you are unable to.
    Aaron Conran
    @aconran

  3. #3
    Ext JS Premium Member Artistan's Avatar
    Join Date
    Apr 2007
    Location
    MN
    Posts
    144
    Vote Rating
    0
      0  

    Default

    http://www.sencha.com/learn/using-va...n-sencha-touch
    format with a "matcher"
    There is no matcher property on the Format Validation Component.

    Code:
    Ext.ns('MyApp');   MyApp.Product = Ext.regModel('Product', {     fields: [         {name: 'id',      type: 'int'},         {name: 'user_id', type: 'int'},         {name: 'name',    type: 'string'},         {name: 'price',   type: 'float'},         {name: 'sku',     type: 'string'}     ],       validations: [         {type: 'presence', name: 'name'},         {type: 'format',   name: 'sku', matcher: /[0-9]{4}[A-Z]+/},         {type: 'length',   name: 'name', min: 3}     ],       proxy: {         type: 'localstorage',         id  : 'products'     } });

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default Tried adding matcher with the filter box

    I tried adding a matcher by typing it in the filter list box and clicking the add button, it puts the value inside tics though so regular expressions don't work. Manually taking the tics out in the code works but of course designer saves over it. Adding it to the file outside of designer works but then designer doesn't see it when the project is loaded.

    Is there a way to add something with the filter box without designer putting quotes around it in the code?

  5. #5
    Sencha User
    Join Date
    Dec 2011
    Location
    Mxico
    Posts
    11
    Vote Rating
    0
      0  

    Default Use the matcher as an object

    You can try to use the matcher as an object and put the value of the object between slashs ("/"), for example:

    /^[-]?[0-9]*[.]{0,1}[0-9]*$/

    In my case this results in:
    {
    type: 'format',
    message: 'Format error',
    matcher: /^[-]?[0-9]*[.]{0,1}[0-9]*$/,
    field: 'field01'
    }


    I hope this can help you.

Posting Permissions

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