473,756 Members | 5,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Safari display:none in a list

Hello,
I have the following template that basically does the following:

User select Country, then a sub-list is generated with Regions and
then this returns the Counties

###############

<tr>
<td colspan="2">
Region<br/>
<select onchange="selec t_country(this. value)" style="width:
80%">
<option value="none"></option>
<option stl:repeat="cou ntry countries" value="country_ $
{country/id}"
selected="${cou ntry/is_selected}">$ {country/title}</
option>
</select>
(Country)
<br/>
<select onchange="selec t_region(this.v alue)" style="width:
80%">
<option value="none"></option>
<optgroup stl:repeat="cou ntry countries" id="country_$
{country/id}"
disabled="disab led" style="display: ${country/display}">
<option stl:repeat="reg ion country/regions"
value="region_$ {region/id}"
selected="${reg ion/is_selected}">$ {region/title}</
option>
</optgroup>
</select>
(Region)
<br/>
<select name="abakuc:co unty" style="width: 80%">
<option value=""></option>
<optgroup stl:repeat="reg ion regions" id="region_${re gion/
id}"
disabled="disab led" style="display: ${region/display}">
<option stl:repeat="cou nty region/counties" value="$
{county/id}"
selected="${cou nty/is_selected}">$ {county/title}</
option>
</optgroup>
</select>
(County)
</td>
</tr>
###############

I also have this simple javascript:

###############

function select_country( value) {
/* Hide */
var groups = document.getEle mentsByTagName( 'optgroup');
var group;
for (var i=0; i<groups.length ; i++) {
group = groups[i];
group.style.dis play = 'none';
group.disabled = true;
}

/* Show */
var element = document.getEle mentById(value) ;
element.style.d isplay = 'inherit';
element.disable d = false;
}

function select_region(v alue) {
/* Hide */
var groups = document.getEle mentsByTagName( 'optgroup');
var group;
for (var i=0; i<groups.length ; i++) {
group = groups[i];
if (group.id.subst r(0, 7) == "region_") {
group.style.dis play = 'none';
group.disabled = true;
}
}

/* Show */
var element = document.getEle mentById(value) ;
element.style.d isplay = 'inherit';
element.disable d = false;
}

###############

Now everything works great on Firefox, not yet tested on IE, but I am
suppriesed that it does not work on Safari.

Searching on Google does reviel that Safari has a BUG with the
display:none

Anyone with a solution on how to best fix this problem.

Many thanks

Norman

Jun 9 '07 #1
7 4064
In article
<11************ **********@g4g2 000hsf.googlegr oups.com>,
khinester <no**********@g mail.comwrote:
Hello,
I have the following template that basically does the following:

User select Country, then a sub-list is generated with Regions and
then this returns the Counties
.....
>
Now everything works great on Firefox, not yet tested on IE, but I am
suppriesed that it does not work on Safari.
Supply a URL so we can see.

--
dorayme
Jun 9 '07 #2

dorayme wrote:
In article
<11************ **********@g4g2 000hsf.googlegr oups.com>,
khinester <no**********@g mail.comwrote:
Hello,
I have the following template that basically does the following:

User select Country, then a sub-list is generated with Regions and
then this returns the Counties
....

Now everything works great on Firefox, not yet tested on IE, but I am
suppriesed that it does not work on Safari.

Supply a URL so we can see.

--
dorayme
Hi here is the form

http://uktravellist.info/information/data/address.html

If you select United Kingdom for example, on FF only lists the regions
for the UK, but on Safari it lists all the regions for all the
Countries that have regions. currently only France, UK and USA.

Cheers

Norman

Jun 10 '07 #3
In article
<11************ **********@h2g2 000hsg.googlegr oups.com>,
Norman <no**********@g mail.comwrote:
dorayme wrote:
In article
<11************ **********@g4g2 000hsf.googlegr oups.com>,
khinester <no**********@g mail.comwrote:
Hello,
I have the following template that basically does the following:
>
User select Country, then a sub-list is generated with Regions and
then this returns the Counties
....
>
Now everything works great on Firefox, not yet tested on IE, but I am
suppriesed that it does not work on Safari.
Supply a URL so we can see.

--
dorayme

Hi here is the form

http://uktravellist.info/information/data/address.html

If you select United Kingdom for example, on FF only lists the regions
for the UK, but on Safari it lists all the regions for all the
Countries that have regions. currently only France, UK and USA.
Right. Well, the first thing to realise is that Safari has,
usefully in a way, poor error correction. iCab is stupidly happy
in its "face" (never mind this if you are not a Mac person) but
equally not doing what you would want.

And, looking closer at FF, it also plays up on repeated attempts.

I suggest you fix up the 556 failed validation errors that are on
that page. Fix up as many as you can and come back.

The css sheet cannot be found and that is a bit of a puzzle in
itself. You have a base url in your html, is it right?

--
dorayme
Jun 10 '07 #4
On 10 juin, 10:37, dorayme <doraymeRidT... @optusnet.com.a uwrote:
In article
<1181463247.757 589.140...@h2g2 000hsg.googlegr oups.com>,

Norman <norman.kh...@g mail.comwrote:
dorayme wrote:
In article
<1181414405.309 919.197...@g4g2 000hsf.googlegr oups.com>,
khinester <norman.kh...@g mail.comwrote:
Hello,
I have the following template that basically does the following:
User select Country, then a sub-list is generated with Regions and
then this returns the Counties
....
Now everything works great on Firefox, not yet tested on IE, but I am
suppriesed that it does not work on Safari.
Supply a URL so we can see.
--
dorayme
Hi here is the form
http://uktravellist.info/information/data/address.html
If you select United Kingdom for example, on FF only lists the regions
for the UK, but on Safari it lists all the regions for all the
Countries that have regions. currently only France, UK and USA.

Right. Well, the first thing to realise is that Safari has,
usefully in a way, poor error correction. iCab is stupidly happy
in its "face" (never mind this if you are not a Mac person) but
equally not doing what you would want.

And, looking closer at FF, it also plays up on repeated attempts.

I suggest you fix up the 556 failed validation errors that are on
that page. Fix up as many as you can and come back.

The css sheet cannot be found and that is a bit of a puzzle in
itself. You have a base url in your html, is it right?

--
dorayme
Hi dorayme,
The problem is that the actual code for this is on my local machine, I
just am using this web space to show the form and how it handles with
with different browsers.

Anyhow, I have uploaded the css as well.

Cheers
Norman

Jun 10 '07 #5
In article
<11************ *********@n4g20 00hsb.googlegro ups.com>,
Norman <no**********@g mail.comwrote:
On 10 juin, 10:37, dorayme <doraymeRidT... @optusnet.com.a uwrote:
In article
<1181463247.757 589.140...@h2g2 000hsg.googlegr oups.com>,

Norman <norman.kh...@g mail.comwrote:
dorayme wrote:
>http://uktravellist.info/information/data/address.html
If you select United Kingdom for example, on FF only lists the regions
for the UK, but on Safari it lists all the regions for all the
Countries that have regions. currently only France, UK and USA.
Right. Well, the first thing to realise is that Safari has,
usefully in a way, poor error correction. iCab is stupidly happy
in its "face" (never mind this if you are not a Mac person) but
equally not doing what you would want.

And, looking closer at FF, it also plays up on repeated attempts.

I suggest you fix up the 556 failed validation errors that are on
that page. Fix up as many as you can and come back.

The css sheet cannot be found and that is a bit of a puzzle in
itself. You have a base url in your html, is it right?

--
dorayme

Hi dorayme,
The problem is that the actual code for this is on my local machine, I
just am using this web space to show the form and how it handles with
with different browsers.

Anyhow, I have uploaded the css as well.
But the errors are still there, there are 553 today. Anyway, I
will mention that in my FF (latest) when picking UK, it lists
regions of France. But then so does Turkmenistan and others.
Basically, it does not work, nothing particularly to do with
Safari. Follow the suggestion to fix up all errors.

Actually it is not clear what the whole context is? If it is
going to give you a big headache maybe do it simpler. Have at
least the regions and counties text boxes filled in by the user,
and perhaps use more general names for the categories. We don't
have counties here in Australia, there are states, cities, towns,
suburbs. Why not leave all at one simple box, "Full postal
address" and be done?

--
dorayme
Jun 10 '07 #6
On Jun 11, 1:12 am, dorayme <doraymeRidT... @optusnet.com.a uwrote:
In article
<1181486713.568 996.38...@n4g20 00hsb.googlegro ups.com>,

Norman <norman.kh...@g mail.comwrote:
On 10 juin, 10:37, dorayme <doraymeRidT... @optusnet.com.a uwrote:
In article
<1181463247.757 589.140...@h2g2 000hsg.googlegr oups.com>,
Norman <norman.kh...@g mail.comwrote:
dorayme wrote:
http://uktravellist.info/information/data/address.html
If you select United Kingdom for example, on FF only lists the regions
for the UK, but on Safari it lists all the regions for all the
Countries that have regions. currently only France, UK and USA.
Right. Well, the first thing to realise is that Safari has,
usefully in a way, poor error correction. iCab is stupidly happy
in its "face" (never mind this if you are not a Mac person) but
equally not doing what you would want.
And, looking closer at FF, it also plays up on repeated attempts.
I suggest you fix up the 556 failed validation errors that are on
that page. Fix up as many as you can and come back.
The css sheet cannot be found and that is a bit of a puzzle in
itself. You have a base url in your html, is it right?
--
dorayme
Hi dorayme,
The problem is that the actual code for this is on my local machine, I
just am using this web space to show the form and how it handles with
with different browsers.
Anyhow, I have uploaded the css as well.

But the errors are still there, there are 553 today. Anyway, I
will mention that in my FF (latest) when picking UK, it lists
regions of France. But then so does Turkmenistan and others.
Basically, it does not work, nothing particularly to do with
Safari. Follow the suggestion to fix up all errors.

Actually it is not clear what the whole context is? If it is
going to give you a big headache maybe do it simpler. Have at
least the regions and counties text boxes filled in by the user,
and perhaps use more general names for the categories. We don't
have counties here in Australia, there are states, cities, towns,
suburbs. Why not leave all at one simple box, "Full postal
address" and be done?

--
dorayme
OK thanks for the suggestions, I will try to fix the errors.
Cheers
Norman

Jun 11 '07 #7
On Jun 10, 4:40 am, khinester <norman.kh...@g mail.comwrote:
Hello,
I have the following template that basically does the following:

User select Country, then a sub-list is generated with Regions and
then this returns the Counties
[...HTML with select and optgroup elements ...]
>
Now everything works great on Firefox, not yet tested on IE, but I am
suppriesed that it does not work on Safari.
Not for me. In Firefox, select an item in an optgroup, then hide the
optgroup and the selected option is still selected and visible. I
don't think you should try to limit the availability of options by
using the stlye.display attribute.

Searching on Google does reviel that Safari has a BUG with the
display:none
Testing shows that Safari doesn't hide optgroups using style.display.

Anyone with a solution on how to best fix this problem.
Instead of hiding the elements, move them to a hidden option element
or remove them from the DOM completely:

<select id="sel0">
<optgroup id="og0" label="set 0">
<option>opt0-0
<option>opt0-1
<option>opt0-2
</optgroup>
<optgroup id="og1" label="set 1">
<option>opt1-0
<option>opt1-1
<option>opt1-2
</optgroup>
</select>

<select id="sel1" style="display: none;">
</select>
<input type="button" value="Show/hide group 0" onclick="
toggleEl(docume nt.getElementBy Id('og0'));
">

<script type="text/javascript">
function toggleEl(el){
var pID = el.parentNode.i d;
if (pID == 'sel0') {
document.getEle mentById('sel1' ).appendChild(e l);
} else {
document.getEle mentById('sel0' ).appendChild(e l);
}
}
</script>
Note that an empty select element will cause an HTML validation error.
--
Rob

Jun 12 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
40757
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person filling out the form is switching from page to page...without the overhead of extra hits on the server,...
10
3604
by: JayB | last post by:
I'm using a style to hide a skip navigation link but it's not working out correctly. The style is: ..textBrowsersOnly { display: none; } I'm using it in a paragragh and in a navigation link but the navigation link still shows up (using an un-ordered list). www.fape.org/zzzzzz.htm
3
18589
by: Iain Hallam | last post by:
Hi. I've been using display:none on the style property of some <option> elements in my forms, which works fine with Mozilla - as expected it removes the option from my dropdown (although it still exists in the code). Is there an equivalent in IE? The reasoning behind this is that I want users to rank objects using a <select> for each place (see below), and to remove the choice of earlier objects from <select> drop-downs later in the...
1
2319
by: fleemo17 | last post by:
For increased accessibility, I've replaced "display:none" with the Off-Left method of hiding my CSS drop-down menus because the Jaws screen reader doesn't see any of the menus hidden with "display:none". The Off-Left method (placing elements way over to the left beyond the browser window) seems to work well in everything except IE 6 for the PC, where it displays the drop-downs about an inch to the right of where they should be. (View...
2
9066
by: Jake Barnes | last post by:
Imagine I've this block of HTML: <p>Alex Schein Mailing List <input type="checkbox" name="newslettersToUse" value="133156"> (<a href="mcControlPanel.php" onClick="hideOrShowDivById('emailList133156'); return false;">See emails?</a>)</p> <form method="post" action="mcControlPanel.php" id="emailList133156" style="display:none;"><textarea name="formInputs">nazjeehaj@son.org,
2
9609
by: Good Man | last post by:
Hi there I have quite a bit of experience with CSS but I am stumped by the following: http://www.electricphase.com/example/example1.php (uses http://www.electricphase.com/example/test1.css) http://www.electricphase.com/example/example2.php (uses http://www.electricphase.com/example/test2.css)
5
2034
by: libsfan01 | last post by:
function switch_display(switchme) { var el = document.getElementById(switchme); el.style.display = (el.style.display == 'none')? '' : 'none'; } im using this function to switch the display on and off of a given element. BUT if the element is set to 'none' to begin with then it wont display it. please help...
15
3165
by: cssExp | last post by:
hello, Rather than going on a wild explanation on what's the the problem, it'll be much quicker and easier if i let you look at it yourself, so I'll post my page source (actual contents taken out, of course). <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Language" content="en-us" />
2
19726
hsriat
by: hsriat | last post by:
All the elements which were set as style={display:none} are still being shown in Safari (Apple's Browser)... But when the same style is applied with javascript on an event, it hides the element. Like this... document.getElementById('abc').style.display='none'; This one is also not working: style="{background-image:url('/img/logo.png');background-repeat:no-repeat}" Both are working all good with Firefox, Opera and even IE 6 (which I...
0
9456
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
9275
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
10040
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
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...
0
9713
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...
0
8713
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.