script not working in Safari

P

Pasquale

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.checked) {
choicecount++;
regsubevtarray.push(subevtobj.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-->
 
F

Fred Oz

Pasquale said:
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?
 
F

Fred Oz

Pasquale said:
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.checked) {


if (formobj.regsubevt.checked) {

or more formally

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

regsubevtarray.push(formobj.regsubevt.value);

...

etc.

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

Pasquale

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 said:
Pasquale said:
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.checked) {



if (formobj.regsubevt.checked) {

or more formally

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

regsubevtarray.push(formobj.regsubevt.value);

...

etc.

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

Fred Oz

Pasquale said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top