View Full Version : form.findField finding a field with the same id outside the form
topcoder1
23 Aug 2007, 2:19 PM
I have two input elements with the same name and id 'my_input_id' in two separate forms form a and form b. The forms have different ids. I verified these from dom inspector on ff.
for some reason b.findField('my_input_id') returns the actual field from form a. is this expected or a bug?
or maybe it's just me..
devnull
23 Aug 2007, 3:36 PM
Its not just you, i had the same problem when using domQuery, even though my selectors were unique ("#div1 #myform #myfield" vs "#div2 #myform #myfield"). I just chalked it up as a css selector bug/feature, gave my fields unique values and moved on.
mystix
23 Aug 2007, 11:04 PM
according to the W3C specs (http://www.w3.org/TR/html401/struct/global.html#h-7.5.2), with regard to a tag's id
This attribute assigns a name to an element. This name must be unique in a document.
i.e. html tag ids must be unique within the DOM.
tag names on the other hand, need not be unique.
topcoder1
23 Aug 2007, 11:12 PM
I just let these input elements have the same name, but not assigning them ids manually, this way it's still ok when their values are passed to the server.
mystix
24 Aug 2007, 12:08 AM
ahh.. that'll work.
u could also use Ext.id() to generate unique ids for dynamically created HTMLElements too.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.