-
13 Dec 2011 5:46 PM #1
[PR3] IDs not being set on numberfield fields?
[PR3] IDs not being set on numberfield fields?
It looks like IDs aren't being set on form elements that specify an ID.
This:
produces this in the DOM:Code:{ xtype:'fieldset', defaults:{ labelWidth:'35%', listeners:{ change:myChangeEvent } }, items:[ { id:'myId', xtype:'numberfield', name:'myMax', label:'MyLabel', // disabled:true, disabledCls:'disabledVisible' } ] } }
Ext.getCmp('myId') seems to return an element, but Ext.getCmp('myId').getValue() only returns the initial value of the numberfield.Code:<input class="x-input-el x-form-field x-input-number" type="number" id="ext-element-290" name="myMax">
Somehow the DOM and the ext element are de-synced.
-
13 Dec 2011 7:53 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 436
- id should only be used for debugging purposes. It isn't worth writing a system to have unique ids. Code for reusability
- Using the following code, Ext.getCmp('myId') got the correct field. Ext.getCmp('myId').getValue() returned 0. I then typed 3 into the field and did the getValue() again and it returned 3 as expected. I cannot reproduce this error in PR3.
Code:Ext.create('Ext.form.Panel', { fullscreen : true, items : [ { xtype:'fieldset', items:[ { id:'myId', xtype:'numberfield', name:'myMax', label:'MyLabel', disabledCls:'disabledVisible' } ] } ] });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.
-
14 Dec 2011 12:25 PM #3
I'm using the IDs to drive automated testing. In 1.1.0 and 1.1.1, IDs were being assigned to elements on the DOM.
getValue and setValue also aren't working for me, so I'll try and create a full example on jsfiddle. I still think not creating actual IDs is an issue.
-
14 Dec 2011 12:33 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 436
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.
-
14 Dec 2011 1:45 PM #5
So if Sencha Touch is automatically assigning IDs, then how do you suggest he do automated testing via say Selenium if the ids change each time the app is run?
-
14 Dec 2011 2:33 PM #6Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,653
- Vote Rating
- 14
Indeed if the id isn't being respected, this is a bug and needs to be handled properly. Assigning ids is a necessary feature.
-
14 Dec 2011 5:57 PM #7
I didn't have the root cause here of another issue. I'm going to close this and re-post; the IDs are being set properly.
Looks like we cannot reproduce this. Please provide another test case to reproduce this issue.


Reply With Quote