-
2 Jan 2012 4:02 AM #1
Using square brackets in field name breaks selectfield reset
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 Jan 2012 6:54 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
This is because the square brackets mean something to ComponentQuery.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
2 Jan 2012 6:58 AM #3
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
-
27 Jan 2012 2:00 PM #4
How can this be closed?
Isn't it a legitimate bug if ComponentQuery is re tasking a legitimate character used in form names?
Rich
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote