473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Dynamic selects using optgroups not working in IE

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
6 1806
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: cedawe | last post by:
I have two select boxes. When the user picks a value in the first one it completely re-populates the second one. It works fine, but only generates a standard OPTIONS list and I now want to group...
13
by: mr_burns | last post by:
hi, is it possible to change the contents of a combo box when the contents of another are changed. for example, if i had a combo box called garments containing shirts, trousers and hats, when...
25
by: jullag | last post by:
Hi, does anyone know of any javascript method that does the same job as document.write(), but not necessarily at the end of the document? For instance, insert some text inside an element that...
16
by: Brian D | last post by:
I have a multiple select list that is created dynamically based on a previous selection on an asp page. The first thing I do is to clear the curent option list by ...
1
by: TKapler | last post by:
I think i am quite experienced javascript programmer, but I got a problem. I have a selectbox with e.g. 17 optgroups with 100 options. I need a javascript code to hide some of that optgroups (i...
3
by: drblitzkrieg | last post by:
Hi, I have a page with 2 drop-down menus. The task is, when you select 1 menu, your selection then changes the options available in the other. This data happens to be drawn from a mysql database,...
3
by: Pascal Ehlert | last post by:
Hi group! After my first post a few days ago and your advice not to use the Prototype Framework (which indeed was a good idea! ;-)) I rewrote my script for dynamic select lists. This is what it...
9
by: =?Utf-8?B?RXZlcnQ=?= | last post by:
In my (Windows Forms) project I am using strongly typed datatables. Now I am trying to convert my 'rowfilter/group by' query logic to Linq. Most queries I can easily convert, but some I am having...
4
by: =?Utf-8?B?RHlsYW5TbWl0aA==?= | last post by:
I have a WebForm where I'm dynamically creating some controls and I'm having difficulty understanding how the state is being persisted and how to work with it. I've created a simplified example...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.