View Full Version : Multiple Singleton Form using item with same id

25 Sep 2007, 5:10 PM

I want to use forms as singleton so I got differents forms for different model (database table). For the mapping of the form fied I use the name and id who are the same and the value is set in function of the table colum

Exemple (did take out some text but just figure taht a ManagementPanel is a form)

new Ext.form.TextField({
id: 'section',
fieldLabel: 'Section',
name: 'section',

new Ext.form.TextField({
id: 'departement_id',
fieldLabel: 'D

25 Sep 2007, 5:30 PM
ID's should be unique, there's no real way around it.

25 Sep 2007, 5:44 PM
Their's probably a soution since when you add some node to a tree the id is no use for the element but just as a reference. I think node could have same Ids if they are in a different tree.

25 Sep 2007, 5:52 PM

25 Sep 2007, 6:31 PM
I know all my XHTML and DOM rule... that's not the point

Node in a tree are pass a ID who's not use in the dom element but only as a reference for Ext...

I'm wondering if there's a solution for this for form field in the add option.

25 Sep 2007, 7:07 PM
I'm not going to bother posting the whole trace, but if you track from field.js up to component.js, you'll see that if you specify an id, that element will be rendered with that id to the DOM.

26 Sep 2007, 3:00 AM
In the tree I did do a inspect with Firebug and I did found anything around the node using the Id I did pass... maybe I didn't check properly...

26 Sep 2007, 4:01 AM
You're talking about a form, not a tree, they act differently.

26 Sep 2007, 4:23 AM
That's my point ! I would like the Id of a field to be manage like a Id of a tree node. :D

26 Sep 2007, 4:30 AM
I know that you'd like that, but as I said earlier, it doesn't appear to be possible with Ext at the moment, so you will either have to
a) Modify Ext
b) Come up with your own solution

26 Sep 2007, 2:59 PM
It's not exactly what I've done but it's the concept who's important

MyForm = function (config)

add : function()
for(var i = 0 ; i < arguments.length ; i++)
item = arguments[i];
item.id = item.id != undefined ? item.id : item.name + Ext.id();
Ext.form.Form.prototype.add.apply(this, arguments);