473,796 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_op tions. 
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 1825
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_op tions. 
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...@we b.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*********@we b.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
35148
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 the options using OPTGROUPs. <select name="Selector1" size="1" onchange="reload2(this.options.selectedIndex, document.Form1.Selector2)"> <option ..... </select>
13
2899
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 the user selects shirts another combo box called 'size' would contain sizes in relation to shirts (ie. chest/neck size). the same would occur for trousers and hats. when the user selects an option in the garment combo box, the options available...
25
3511
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 has a specific ID tag? thanks a lot JL
16
13620
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 document.form1.itemcross.length = 0; The only problem is that it leaves the optgroups. How do I also get rid of the optgroups? Thanks
1
4623
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 can give each optgroup individual ID, e.g. id="group1"..."group"17). e.g. the html code looks like: <select name="mySelect" id="mySelect"> <optgroup label="First group" id="group1" > <option value="a" > Item A
3
2041
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, so I wouldn't think that it could be done purely in Javascript, but rather a combination of PHP generating some JS code. Thing is, I don't even see how to change a set of menu options with JavaScript, only names and values of individual fields. ...
3
1718
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 looks like now: http://pastie.caboo.se/140953 (I know it's messy, but I don't see another way) Let me explain how it works in short. First it get's all select elements with classes dynamic_select and
9
14067
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 difficulties with: the ones dynamic in nature. I solved it (temporary) by copy-pasting static queries. This is not an ideal solution because now my code contains some duplicate code. Some of the problems I have are: - My select statements...
4
4766
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 to demonstrate my issues. Lets say I have a WebForm with a DropDownList where the user selects a number from 1 to 10 (the DropDownList is not dynamically created). I also have a button on there that I use to trigger a PostBack. Based on the...
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10221
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.