By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,619 Members | 2,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,619 IT Pros & Developers. It's quick & easy.

Dynamic selects using optgroups not working in IE

P: n/a
Hi group!

I was trying to build a JS solution for related select lists (child
lists gets populated depending on the value selected in parent list),
which uses no Ajax and is still "usable" in an environment with JS
disabled. 
I have done this with the Low Pro framework which basically
just registers event handlers on certain elements chosen by CSS
selectors.
This is the result: 
http://pastie.caboo.se/136818
The initialize function first sets this.child to the next child element
(css classes "related" and "child") it can find, then parses it's
options (I have used option groups there which are still meaningful
without JS) and saves it to this.grouped_options. 
Now as soon as the
parent value changes it populates the child list from the stored
options.
That not only sounds nice but also works, with one major drawback..

The reason for my post. It works fine in Firefox and Safari but it
doesn't work at all in Internet Explorer 6 or 7.
It just stops, gives some IE typical error messages with non-existing
line numbers etc. and doesn't even remove the old options from the
child list.
Here is a live example: 
http://odatest.hacksrus,net/sandbox.html
I hope someone can help me out and since I'm still a newbie to JS, I'd
also appreciate all other tips concerning the code.
By the way.. I've even heard that it works sometimes, it's really weird..
Regards
Pascal

Jan 16 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Jan 16, 4:17*pm, Pascal Ehlert <pascal.ehl...@odadata.euwrote:
Hi group!

I was trying to build a JS solution for related select lists (child
lists gets populated depending on the value selected in parent list),
which uses no Ajax and is still "usable" in an environment with JS
disabled. 
I have done this with the Low Pro framework which basically
just registers event handlers on certain elements chosen by CSS
selectors.
This is the result: 
http://pastie.caboo.se/136818
The initialize function first sets this.child to the next child element
(css classes "related" and "child") it can find, then parses it's
options (I have used option groups there which are still meaningful
without JS) and saves it to this.grouped_options. 
Now as soon as the
parent value changes it populates the child list from the stored
options.
That not only sounds nice but also works, with one major drawback..

The reason for my post. It works fine in Firefox and Safari but it
doesn't work at all in Internet Explorer 6 or 7.
It just stops, gives some IE typical error messages with non-existing
http://www.jibbering.com/faq/faq_not...ml#ps1DontWork
line numbers etc. and doesn't even remove the old options from the
child list.
Here is a live example: 
http://odatest.hacksrus,net/sandbox.html
No, that is a dead link (even with the typo corrected.)
Jan 16 '08 #2

P: n/a
Pascal Ehlert wrote:
I was trying to build a JS solution for related select lists (child
lists gets populated depending on the value selected in parent list),
which uses no Ajax and is still "usable" in an environment with JS
disabled. 
I have done this with the Low Pro framework which basically
just registers event handlers on certain elements chosen by CSS
selectors.
This is the result: 
http://pastie.caboo.se/136818
The initialize function first sets this.child to the next child element
(css classes "related" and "child") it can find, [...]
I would hope Low Pro would mean "Low Profile", because that is what it
should keep. Once you stopped using the Prototype junk and everything that
is based on it, including Low Pro, someone here might actually be inclined
to analyze your problem. And please get rid of the nonsensical Unobtrusive
JavaScript notion while you are at it.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jan 16 '08 #3

P: n/a
Hi again,

On 2008-01-17 00:34:36, Thomas 'PointedEars' Lahn said:
I would hope Low Pro would mean "Low Profile", because that is what it
should keep. Once you stopped using the Prototype junk and everything that
is based on it, including Low Pro, someone here might actually be inclined
to analyze your problem. And please get rid of the nonsensical Unobtrusive
JavaScript notion while you are at it.
What's so bad about JS frameworks? (Or don't you mean frameworks in
general but Prototype in particular?)
Could you please explain? "Get rid of it" isn't much better than
"doesn't work".
Pascal

Jan 17 '08 #4

P: n/a
Pascal Ehlert wrote:
On 2008-01-17 00:34:36, Thomas 'PointedEars' Lahn said:
>I would hope Low Pro would mean "Low Profile", because that is what it
should keep. Once you stopped using the Prototype junk and everything that
is based on it, including Low Pro, someone here might actually be inclined
to analyze your problem. And please get rid of the nonsensical Unobtrusive
JavaScript notion while you are at it.

What's so bad about JS frameworks?
The utter incompetence of most of their authors (especially the most
celebrated ones) that becomes apparent when peer-reviewing their code.
(Or don't you mean frameworks in general but Prototype in particular?)
Both.
Could you please explain?
Certainly not. Search the newgroup's archives, we have already discussed
this here /ad nauseam/.
"Get rid of it" isn't much better than "doesn't work".
In that case, the latter is the justification for the former.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jan 17 '08 #5

P: n/a
On Jan 17, 5:32*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
Pascal Ehlert wrote:
On 2008-01-17 00:34:36, Thomas 'PointedEars' Lahn said:
I would hope Low Pro would mean "Low Profile", because that is what it
should keep. *Once you stopped using the Prototype junk and everything that
is based on it, including Low Pro, someone here might actually be inclined
to analyze your problem. *And please get rid of the nonsensical Unobtrusive
JavaScript notion while you are at it.
What's so bad about JS frameworks?

The utter incompetence of most of their authors (especially the most
celebrated ones) that becomes apparent when peer-reviewing their code.
No question about that.

I recently stumbled across a proposed outline for a new book on
JavaScript by the jQuery guy. One of the chapters will apparently
address get/setAttribute. Here's hoping he actually learned how to
handle those since the last time he discussed the subject here. I
think I saw opacity in there too (which he frequently cites as an
example of something that requires user agent string parsing.) I
didn't see a specific chapter on browser sniffing, but I expect it
will be a recurring theme.
Jan 17 '08 #6

P: n/a
Hi again!

On 2008-01-17 00:34:36 +0100, Thomas 'PointedEars' Lahn
<Po*********@web.desaid:
Once you stopped using the Prototype junk and everything that
is based on it, including Low Pro, someone here might actually be inclined
to analyze your problem. And please get rid of the nonsensical Unobtrusive
JavaScript notion while you are at it.
Thanks so much! That was actually the best advice you could have given to me.
It's so much easier to debug etc. without that crap. Looks nice, smells
shitty ;)

I will ask a more meaningful question next time!
Regards
Pascal

Jan 18 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.