472,800 Members | 1,219 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 3956
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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.