-
30 Oct 2006 10:18 AM #1
DomHelper: cannot create a label tag
DomHelper: cannot create a label tag
Captain, I canna
because 'for' is a reserved word, but is also a required attribute for a label tag.Code:dh.append(myThang, {tag: 'label, for: 'anything'});
Cheers.
-
30 Oct 2006 10:36 AM #2
-
30 Oct 2006 10:47 AM #3
Well, dip me in cornflour and deep fry me. It does work.
Excuse me, Jack, KuN, and all.
-
30 Oct 2006 11:50 AM #4
Ach, in fact it does not work... in IE 6 and in an older Firefox. "for" is indeed a reserved word, and is not permitted as a property identifier in an object.'for':'anything'
doesnt work?
Jack, if you're reading this, my current workaround is to patch DomHelper something like
andCode:if(attr == 'cls'){ b += ' class="' + o['cls'] + '"'; }else if(attr == 'forfield'){ b += ' for="' + o[attr] + '"'; }else{ b += ' ' + attr + '="' + o[attr] + '"'; }
I'm not advocating for "forfield" as a "good" solution; I trust your aesthetics about that.Code:if(attr=='cls'){ el.className = o['cls']; }else if (attr=='forfield') { el.htmlFor = o['forfield']; }else{ if(useSet) el.setAttribute(attr, o[attr]); else el[attr] = o[attr]; }
Cheers.
-
30 Oct 2006 11:59 AM #5
Better yet, if you use
as the special property, you only have to patch the html gen side, not the dom side.Code:htmlFor
-
30 Oct 2006 12:13 PM #6
I have never run into an error using 'for', but it doesn't surprise me that it could throw an error.
I used the htmlFor patch. Thanks for posting it.
Code:... if(attr == 'cls'){ b += ' class="' + o['cls'] + '"'; }else if(attr == 'htmlFor'){ b += ' for="' + o['htmlFor'] + '"'; }else{ b += ' ' + attr + '="' + o[attr] + '"'; } ...
-
30 Oct 2006 12:16 PM #7
You are most welcome. It's a tiny drop in the ext bucket.I used the htmlFor patch. Thanks for posting it.
Similar Threads
-
how to create element in dom
By humpdi in forum Ext 1.x: Help & DiscussionReplies: 7Last Post: 29 Mar 2007, 11:13 PM -
create entire UI without ids?
By em_te in forum Ext 1.x: Help & DiscussionReplies: 16Last Post: 28 Mar 2007, 10:47 AM -
How to give spacing between Label and TextField in Form ?
By saasira in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 12 Mar 2007, 10:35 PM -
Add a wait gif to a tab label
By dmayer in forum Ext 1.x: Help & DiscussionReplies: 1Last Post: 20 Nov 2006, 1:42 PM


Reply With Quote