Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    11
    Vote Rating
    0
    kim3er is on a distinguished road

      0  

    Default Using square brackets in field name breaks selectfield reset

    Sencha Touch 1.1.0
    Tested on iOS 5.0

    Ruby on Rails require field names in the following format 'model[property]', so my ST form field names use the same format:

    ...
    {
    xtype: 'selectfield',
    name : 'asb[asb_type_id]',
    label: 'Type',
    valueField : 'id',
    displayField : 'name',
    store : app.stores.asbTypes
    },
    {
    xtype : 'textareafield',
    name : 'asb[description]',
    label : 'Description',
    maxLength : 60,
    maxRows : 5
    },
    ...

    This only becomes a problem when reseting a 'selectfield' field. The following error is thrown:

    "Invalid ComponentQuery selector: "]""

    The error relates to the function called 'child' that is called when the selectfield attempts to reset the picker value, calling a query on something like:

    '[name=model[property]]'

    The call stack is:

    FormPanel.reset()
    Select.reset()
    Select.setValue()
    Picker.setValue() - Line 28589
    Picker.child() - Line 25509

    Rich

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,534
    Vote Rating
    1115
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    This is because the square brackets mean something to ComponentQuery.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    11
    Vote Rating
    0
    kim3er is on a distinguished road

      0  

    Default

    Which is why I believe it is a bug. Unless of course W3C doesn't allow square brackets in the name attribute, my impression was that they were allowed.

    Rich

  4. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    11
    Vote Rating
    0
    kim3er is on a distinguished road

      0  

    Default

    How can this be closed?

    Isn't it a legitimate bug if ComponentQuery is re tasking a legitimate character used in form names?

    Rich