473,508 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

script not working in Safari

I am using the function below to add multiple checkbox selection to an
array. The form gets submitted to a PHP script. The function works fine
with IE 6, Netscape 7 and Firefox 1, but it is not working with Safari
125. Is there something I just can't see that would cause this??

Thanks.
<!--Begin
var submitcntiselect = 0;
function SubmitChkIselect () {
var formobj = document.forms['iregevtslct'];
var subevtobj = formobj.elements['regsubevt'];
if (submitcntiselect == 0) {
var choicecount = 0;
var regsubevtarray = new Array();
for (var i = 0; i <= 4; i++) {
if (subevtobj[i].checked) {
choicecount++;
regsubevtarray.push(subevtobj[i].value);
}
if ((formobj.elements['allsprints'].checked) ||
((subevtobj[0].checked) && (subevtobj[1].checked) &&
(subevtobj[2].checked))) {
formobj.elements['series'].value = 1;
}
}
formobj.elements['regsubevtarrayfld'].value = regsubevtarray;
if (choicecount == 0) {
alert('Please select at least one event.');
return false;
}
submitcntiselect++;
return true;
} else {
alert('This form has already been submitted. Please wait...');
return false;
}
}
//--End-->

Jul 23 '05 #1
4 1721
Pasquale wrote:
I am using the function below to add multiple checkbox selection to an
array. The form gets submitted to a PHP script. The function works fine
with IE 6, Netscape 7 and Firefox 1, but it is not working with Safari
125. Is there something I just can't see that would cause this??

Thanks.


But where is the associated HTML?

--
Fred
Jul 23 '05 #2
Pasquale wrote:
I am using the function below to add multiple checkbox selection to an
array. The form gets submitted to a PHP script. The function works fine
with IE 6, Netscape 7 and Firefox 1, but it is not working with Safari
125. Is there something I just can't see that would cause this??

Thanks.
<!--Begin
var submitcntiselect = 0;
function SubmitChkIselect () {
var formobj = document.forms['iregevtslct'];
var subevtobj = formobj.elements['regsubevt'];
Here's the problem. Seems Safari doesn't like checkbox
collections being referenced this way - is that a bug?

Don't use subevtobj, use the form reference and access the
collection as below...
if (submitcntiselect == 0) {
var choicecount = 0;
var regsubevtarray = new Array();
for (var i = 0; i <= 4; i++) {
if (subevtobj[i].checked) {
if (formobj.regsubevt[i].checked) {

or more formally

if (formobj.elements['regsubevt'][i].checked) {
choicecount++;
regsubevtarray.push(subevtobj[i].value); regsubevtarray.push(formobj.regsubevt[i].value);

...

etc.

Referencing form elements this way should not create problems in
any other browser that supports the forms collection.
--
Fred
Jul 23 '05 #3
Thanks for the info. I'll see how it works.
It may not be a bug, but it seems that it doesn't meet standard. Where
would I find this kind of info?

Fred Oz wrote:
Pasquale wrote:
I am using the function below to add multiple checkbox selection to an
array. The form gets submitted to a PHP script. The function works
fine with IE 6, Netscape 7 and Firefox 1, but it is not working with
Safari 125. Is there something I just can't see that would cause this??

Thanks.
<!--Begin
var submitcntiselect = 0;
function SubmitChkIselect () {
var formobj = document.forms['iregevtslct'];
var subevtobj = formobj.elements['regsubevt'];

Here's the problem. Seems Safari doesn't like checkbox
collections being referenced this way - is that a bug?

Don't use subevtobj, use the form reference and access the
collection as below...
if (submitcntiselect == 0) {
var choicecount = 0;
var regsubevtarray = new Array();
for (var i = 0; i <= 4; i++) {
if (subevtobj[i].checked) {

if (formobj.regsubevt[i].checked) {

or more formally

if (formobj.elements['regsubevt'][i].checked) {
choicecount++;
regsubevtarray.push(subevtobj[i].value);


> regsubevtarray.push(formobj.regsubevt[i].value);

...

etc.

Referencing form elements this way should not create problems in
any other browser that supports the forms collection.


Jul 23 '05 #4
Pasquale wrote:
Thanks for the info. I'll see how it works.
It may not be a bug, but it seems that it doesn't meet standard. Where
would I find this kind of info?

[...]

I think it *is* a bug in Safari. I've reported it through the
Apple Developer Connection, guess we'll have to wait and see. I
would be amazed if it hasn't been reported already.

As for where to find such information... you can search bugzilla
for Mozilla/Firefox errors, and likely there is a place to
search for IE bugs at MS.com, but they work on looking for
reported bugs rather than "show me a list of all bugs that might
affect the JavaScript DOM interface".

I don't know of any resource that lists Safari bugs.

--
Fred
Jul 23 '05 #5

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

Similar topics

5
2435
by: Foreman | last post by:
Using ASPFileUpload (http://support.microsoft.com/default.aspx?scid=kb;en-us;299692) and works for IE6 and FireFox but not Safari. Thanks in advance for your assistance.
13
2218
by: elektrophyte | last post by:
I've got a short script that works fine in I.E. and Firefox, but not in Safari. It is supposed to print a constantly-updating counter on the webpage. Any ideas how to get it to work in Safari? The...
6
24177
by: abdullah1983 | last post by:
Hi Guys, I need some clarification regarding the problem with safari browser. Please find my code below. I'm setting the image src, mouseover and mouseout using javascript. The mouseover and...
13
36063
by: Ralph | last post by:
Hi Is it possible to trigger the certain event from JS function? I have an image with on click event handler assigned. Now if like to trigger this event for this image from some other...
9
8540
by: whitgurley | last post by:
I've searched the web as well as I can for a solution to this problem but have found nothing and just don't know enough about JavaScript to figure out what's going. What I'm trying to do is convert...
6
2261
by: Toby Inkster | last post by:
Does anyone have any idea why this effect using script.aculo.us is working in Opera, but not Firefox? http://examples.tobyinkster.co.uk/Balloons2/Balloon%20tooltip.html (I've not had the...
1
1644
by: Bigpond News Server | last post by:
I have built a website that uses frames and a heavy reliance on Java Script to modify framesets, frames and load pages on the fly. The site works fine when using the PC version of Internet...
3
2282
by: cjparis | last post by:
Hello All I built a simple script to move a div tag with a MouseOver event handler. This worked fine in Safari but would not work in Netscape and Firefox Can anyone help? You can see it...
3
2123
by: jeddiki | last post by:
Hi, I am using this script which is nearly working correctly, but not quite! When a user selects some text from the web-page and copies it, the script is supposed to pick up the current...
0
7129
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...
1
7061
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
7502
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...
0
5637
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,...
1
5057
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...
0
3208
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
1566
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 ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
428
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...

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.