PDA

View Full Version : [CLOSED] Using square brackets in field name breaks selectfield reset



kim3er
2 Jan 2012, 4:02 AM
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

mitchellsimoens
2 Jan 2012, 6:54 AM
This is because the square brackets mean something to ComponentQuery.

kim3er
2 Jan 2012, 6:58 AM
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

kim3er
27 Jan 2012, 2:00 PM
How can this be closed?

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

Rich