-
29 Jan 2008 1:01 AM #1
[2.0??] FormPanel.getForm().setValues() not working...
[2.0??] FormPanel.getForm().setValues() not working...
I'm having an issue with trying to call setValues on a FormPanels form object. I created a FormPanel and dynamically added some text fields to it with the add() method. The text fields that i was adding were created by applying to an existing DOM element.
The problem I am seeing is that the setValues isn't setting the values. I dug a little deeper and it looks like the add() method for a FormPanel does not add the form elements to the underlying BasicForm object. The setValues() method tries to apply the values to the underlying BasicForm object but since the form elements weren't added.. they couldnt' be applied.
Question is.. is this a bug? Or do i need to call something else in order for the form elements to be added to the FormPanel's underlying BasicForm? or is there another way to set values on a FormPanel?
Thanks in advance,
KevinLast edited by mystix; 29 Jan 2008 at 1:35 AM. Reason: moved to 2.x Bugs from 1.x Bugs
-
30 Jan 2008 4:11 AM #2
Hi,
I'm a Ext newbie, but maybe I can help a little.
I think the FormPanel Component does not have any method linke setValues
I don't know if u can use it like that if u want to create the form elements dynamically, but
u have to create the form elements first (where u can set the default values) and then u have to create the FormPanel with these Elements/Items like:
Hope that will helpPHP Code:
var firstname = new Ext.form.TextField({
fieldLabel: 'firstname',
allowBlank: true,
name: 'name',
height: 20,
blankText: 'Enter name',
anchor: '90%',
id: 'firstname',
maxLength: 20,
value: 'blubb' // <- here u can set the initial value
});
var lastname = new Ext.form.TextField({
fieldLabel: 'lastname',
allowBlank: true,
name: 'lastname',
anchor: '90%',
id: 'lastname',
maxLength: 30,
value: 'type in lastname'
});
var formPanel = new Ext.form.FormPanel({
baseCls: 'x-plain', // base css file
labelWidth: 75,
autoScroll: true,
defaultType: 'textfield', // The default type of container represented by this object as registered in Ext.ComponentMgr (defaults to 'panel').
items: [
firstname,
lastname
]
});
and sorry 4 my english
-
30 Jan 2008 4:48 AM #3
As cheek says there is no formPanel.setValues() method. I'm assuming you are using formPanel.form.setValues()? Likewise you should be using formPanel.form.add() to add elements to the form.
-
30 Jan 2008 10:10 PM #4
There was a change between 2.0 and 2.0.1 in which fields dynamically added to a FormPanel at runtime will be added to their underlying BasicForm. Upgrade to 2.0.1 and see if this resolves your issue.
Aaron Conran
@aconran
Sencha Architect Development Team
-
31 Jan 2008 7:24 AM #5
Is the online documentation 2.0.0 or 2.0.1? Is there a way to tell?
I know it's a bit off topic but the current documentation does not reflect this add() change.
I suppose I should start serving the docs from my own local server so I would always know for sure but I was kind of hoping to avoid that.
-
31 Jan 2008 7:40 AM #6
The bug fix is mentioned in the release notes. The online documentation is 2.0.1. We should look into a way to denote the versioning very easily - either by changing the title or putting something prominent on the the Home tab. At this point the easiest way is to simply check the header of one of the Ext files deployed with the docs.
Aaron Conran
@aconran
Sencha Architect Development Team
-
2 Oct 2008 9:07 AM #7


Reply With Quote