473,473 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Create 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="select_country(this.value)" style="width:
80%">
<option value="none"></option>
<option stl:repeat="country countries" value="country_$
{country/id}"
selected="${country/is_selected}">${country/title}</
option>
</select>
(Country)
<br/>
<select onchange="select_region(this.value)" style="width:
80%">
<option value="none"></option>
<optgroup stl:repeat="country countries" id="country_$
{country/id}"
disabled="disabled" style="display: ${country/display}">
<option stl:repeat="region country/regions"
value="region_${region/id}"
selected="${region/is_selected}">${region/title}</
option>
</optgroup>
</select>
(Region)
<br/>
<select name="abakuc:county" style="width: 80%">
<option value=""></option>
<optgroup stl:repeat="region regions" id="region_${region/
id}"
disabled="disabled" style="display: ${region/display}">
<option stl:repeat="county region/counties" value="$
{county/id}"
selected="${county/is_selected}">${county/title}</
option>
</optgroup>
</select>
(County)
</td>
</tr>
###############

I also have this simple javascript:

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

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

/* Show */
var element = document.getElementById(value);
element.style.display = 'inherit';
element.disabled = false;
}

function select_region(value) {
/* Hide */
var groups = document.getElementsByTagName('optgroup');
var group;
for (var i=0; i<groups.length; i++) {
group = groups[i];
if (group.id.substr(0, 7) == "region_") {
group.style.display = 'none';
group.disabled = true;
}
}

/* Show */
var element = document.getElementById(value);
element.style.display = 'inherit';
element.disabled = 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 4020
In article
<11**********************@g4g2000hsf.googlegroups. com>,
khinester <no**********@gmail.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**********************@g4g2000hsf.googlegroups. com>,
khinester <no**********@gmail.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**********************@h2g2000hsg.googlegroups. com>,
Norman <no**********@gmail.comwrote:
dorayme wrote:
In article
<11**********************@g4g2000hsf.googlegroups. com>,
khinester <no**********@gmail.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.auwrote:
In article
<1181463247.757589.140...@h2g2000hsg.googlegroups. com>,

Norman <norman.kh...@gmail.comwrote:
dorayme wrote:
In article
<1181414405.309919.197...@g4g2000hsf.googlegroups. com>,
khinester <norman.kh...@gmail.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*********************@n4g2000hsb.googlegroups.c om>,
Norman <no**********@gmail.comwrote:
On 10 juin, 10:37, dorayme <doraymeRidT...@optusnet.com.auwrote:
In article
<1181463247.757589.140...@h2g2000hsg.googlegroups. com>,

Norman <norman.kh...@gmail.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.auwrote:
In article
<1181486713.568996.38...@n4g2000hsb.googlegroups.c om>,

Norman <norman.kh...@gmail.comwrote:
On 10 juin, 10:37, dorayme <doraymeRidT...@optusnet.com.auwrote:
In article
<1181463247.757589.140...@h2g2000hsg.googlegroups. com>,
Norman <norman.kh...@gmail.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...@gmail.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(document.getElementById('og0'));
">

<script type="text/javascript">
function toggleEl(el){
var pID = el.parentNode.id;
if (pID == 'sel0') {
document.getElementById('sel1').appendChild(el);
} else {
document.getElementById('sel0').appendChild(el);
}
}
</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
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...
10
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...
3
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...
1
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...
2
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"...
2
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) ...
5
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...
15
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,...
2
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....
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
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...
0
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...
1
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
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
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.