aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Dynamically drawn radio buttons not working in MSIE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Dynamically drawn radio buttons not working in MSIE" Watch "Dynamically drawn radio buttons not working in MSIE" New topic
Author

Dynamically drawn radio buttons not working in MSIE

Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

By 'not working' I mean that the checked state doesn't change when clicked.

This sample is working as expected in FireFox but not MSIE 6 or 7.
The Statically drawn ones work fine.



Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Something about asking on a forum makes Google work better.
Here is the solution:
http://cf-bill.blogspot.com/2006/03/another-ie-gotcha-dynamiclly-created.html
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

That's strange. I was only able to verify its broke in IE7. I'd be lying if I said I was surprised though. :roll: Sorry, no solution from me at this time.


GenRocket - Experts at Building Test Data
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

Originally posted by Ben Souther:
Something about asking on a forum makes Google work better.

And google works better when the words in the article titles are spelled correctly.
:roll:


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Spoke too soon.
Firefox (rightly) doesn't like:
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

Yup, as with so many other things, you're going to need to branch the code to put up with IE's failings.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Bear Bibeault:
Yup, as with so many other things, you're going to need to branch the code to put up with IE's failings.


Or use a light library that handles it already? I'll try it the JQuery way and let you know...
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Gregg Bolinger:

...and let you know


Please do.

For now, since non-msie browsers throw a proper exception when I use the whole tag as the argument to createElement, I'm using this:


It's yucky but it seems to be working.
[ October 26, 2007: Message edited by: Ben Souther ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
This is how I do it:

http://pascarello.com/examples/createElement.html

Eric
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Thanks Eric.
I'm going to use your isNameQuirk method.
I like that it only does the actual work the first time you call it.

As an aside for anyone else following this, there is another issue I found in MSIE.
If, you use the same string for the name when creating all of your buttons, and then change the name afterwards, MSIE will still see them as part of the same button group.
In FireFox, changing the names after creation will change the button grouping as well.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Yep that method shaves off milliseconds!

Eric
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Eric Pascarello:
Yep that method shaves off milliseconds!


It's the principle of the thing dammit!
Where would we be without principles?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically drawn radio buttons not working in MSIE