-
21 Aug 2012 11:32 AM #1
Answered: formpanel within fieldset not working...
Answered: formpanel within fieldset not working...
Hi all.
I'm trying to put a radio button, but it's not working to me. I used a formpanel like documentation show to radio field, but when i try to see it in a fieldset, i see the other field but not the radio buttons.
Any body can tell me what is wrong in my code:
I tried wtith differents layout but nothing changes!!Code:Ext.define('MyFirstSencha.view.Contact', { extend:'Ext.form.FieldSet', xtype: 'contactform', config:{ title: 'Contact', layout : 'vbox', iconCls: 'user', items: [ { xtype: 'textfield', name: 'name', label: 'Name' }, { xtype: 'emailfield', name: 'email', label: 'Email' }, { xtype: 'textareafield', name: 'message', label: 'Message' }, { xtype: 'formpanel', config: { title: 'Radios', layout: 'vbox', items: [ { xtype: 'radiofield', name : 'color', value: 'red', label: 'Red', checked: true }, { xtype: 'radiofield', name : 'color', value: 'green', label: 'Green' }, { xtype: 'radiofield', name : 'color', value: 'blue', label: 'Blue' } ] } } ] } });
-
Best Answer Posted by mitchellsimoens
Didn't notice that config object, that was an issue. This works for me:
Code:Ext.define('MyFirstSencha.view.Contact', { extend : 'Ext.form.FieldSet', xtype : 'contactform', config : { title : 'Contact', layout : 'vbox', iconCls : 'user', items : [ { xtype : 'textfield', name : 'name', label : 'Name' }, { xtype : 'emailfield', name : 'email', label : 'Email' }, { xtype : 'textareafield', name : 'message', label : 'Message' }, { xtype : 'formpanel', flex : 1, title : 'Radios', items : [ { xtype : 'radiofield', name : 'color', value : 'red', label : 'Red', checked : true }, { xtype : 'radiofield', name : 'color', value : 'green', label : 'Green' }, { xtype : 'radiofield', name : 'color', value : 'blue', label : 'Blue' } ] } ] } });
-
21 Aug 2012 11:42 AM #2
You should put fieldsets within forms, not the other way around.
Try removing the formpanel around your radio fields:
http://www.senchafiddle.com/#f3PQN (Press Run)Owner of 360releases Ltd. - Sencha Touch & Ext JS consulting
twitter.com/steffenhiller
extjswithrails.com, senchatouchbits.com
-
21 Aug 2012 12:08 PM #3
Hi, Steffen, thanks for reply.
I know this is a way, in fact this works to me earlier, but i just want a panel surrounding the radio buttons, to give it a title, in this case "select color" for example, and to get this like one control, i don't want the red option in the same level of name.
Am I clear? Do you have another solution?
Thanks again!
-
23 Aug 2012 4:24 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
You have "layout : 'vbox'" on your fieldset and need to give the formpanel a size so it can show. Give it flex : 1 and see where that gets you.
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.
-
23 Aug 2012 5:20 AM #5
Hi Mitchell.
Thanks for replying.
I try with your advice (use flex: 1), but it not works, i can't see this formpanel.
I was trying to use height and width in the formpane, because I remembered when you explain me some days ago about some controls need we specify the size explicit, but nothing happen,
Another idea?
Thanks in advance!
-
23 Aug 2012 5:33 AM #6
Try this out:
You had a 'config' in your formpanel that should not have been there, also I changed it to a fieldset and it works.Code:Ext.define('MyFirstSencha.view.Contact', { extend:'Ext.form.FieldSet', xtype: 'contactform', config: { title: 'Contact', layout : 'vbox', iconCls: 'user', items: [ { xtype: 'textfield', name: 'name', label: 'Name' }, { xtype: 'emailfield', name: 'email', label: 'Email' }, { xtype: 'textareafield', name: 'message', label: 'Message' }, { xtype: 'fieldset', //flex: 1, title: 'Radios', //layout: 'vbox', items: [ { xtype: 'radiofield', name : 'color', value: 'red', label: 'Red', checked: true }, { xtype: 'radiofield', name : 'color', value: 'green', label: 'Green' }, { xtype: 'radiofield', name : 'color', value: 'blue', label: 'Blue' } ] } ] }//end config });
-
23 Aug 2012 5:39 AM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
Didn't notice that config object, that was an issue. This works for me:
Code:Ext.define('MyFirstSencha.view.Contact', { extend : 'Ext.form.FieldSet', xtype : 'contactform', config : { title : 'Contact', layout : 'vbox', iconCls : 'user', items : [ { xtype : 'textfield', name : 'name', label : 'Name' }, { xtype : 'emailfield', name : 'email', label : 'Email' }, { xtype : 'textareafield', name : 'message', label : 'Message' }, { xtype : 'formpanel', flex : 1, title : 'Radios', items : [ { xtype : 'radiofield', name : 'color', value : 'red', label : 'Red', checked : true }, { xtype : 'radiofield', name : 'color', value : 'green', label : 'Green' }, { xtype : 'radiofield', name : 'color', value : 'blue', label : 'Blue' } ] } ] } });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.
-
23 Aug 2012 5:50 AM #8
It, works! True, the last problem was with the incorrect config.
Great!
Thanks!!


Reply With Quote