arrays and Safari

P

Pasquale

With the code below, can anyone see why the array and/or the field in
the last line are empty for Safari users? It works with Netscape 6 and
up, IE 6, Firefox, Konqueror.

Thanks,
Pasquale


//begin

snip...

var formobj = document.forms['iregevtslct'];
var choicecount = 0;
var regsubevtarray = new Array();
var regsubevtcnt = formobj.elements['regsubevt'].length;
for (var i = 0; i < regsubevtcnt; i++) {
if (formobj.elements['regsubevt'].checked) {
choicecount++;
regsubevtarray.push(formobj.elements['regsubevt'].value);
}
}
formobj.elements['regsubevtarrayfld'].value = regsubevtarray;

snip...

//end
 
A

ASM

Pasquale a ecrit :
With the code below, can anyone see why the array and/or the field in
the last line are empty for Safari users?

I don't know :)
Safary won't understand array.push ?

But, if you didn't, try using your "choicecount"

if (formobj.elements['regsubevt'].checked) {
regsubevtarray[choicecount] = formobj.elements['regsubevt'].value;
choicecount++;
}
var formobj = document.forms['iregevtslct'];
var choicecount = 0;
var regsubevtarray = new Array();
var regsubevtcnt = formobj.elements['regsubevt'].length;
for (var i = 0; i < regsubevtcnt; i++) {
if (formobj.elements['regsubevt'].checked) {
choicecount++;
regsubevtarray.push(formobj.elements['regsubevt'].value);
}
}
formobj.elements['regsubevtarrayfld'].value = regsubevtarray;
 
R

RobG

Pasquale said:
With the code below, can anyone see why the array and/or the field in
the last line are empty for Safari users? It works with Netscape 6 and
up, IE 6, Firefox, Konqueror.

Thanks,
Pasquale


//begin

snip...

var formobj = document.forms['iregevtslct'];
var choicecount = 0;
var regsubevtarray = new Array();
var regsubevtcnt = formobj.elements['regsubevt'].length;
for (var i = 0; i < regsubevtcnt; i++) {
if (formobj.elements['regsubevt'].checked) {
choicecount++;
regsubevtarray.push(formobj.elements['regsubevt'].value);
}
}
formobj.elements['regsubevtarrayfld'].value = regsubevtarray;

snip...

//end


I can only guess that you have something in your HTML that Safari
doesn't like. The following works fine in Safari 1.0.3 (OS X 10.2.8).

<script type="text/javascript">

function showChecked() {

var formobj = document.forms['iregevtslct'];
var choicecount = 0;
var regsubevtarray = new Array();
var regsubevtcnt = formobj.elements['regsubevt'].length;

for (var i=0; i<regsubevtcnt; i++) {
if (formobj.elements['regsubevt'].checked) {
choicecount++;
regsubevtarray.push(formobj.elements['regsubevt'].value);
}
}
formobj.elements['regsubevtarrayfld'].value =
regsubevtarray.join('\n');
}

</script>

<form name="iregevtslct" action="">
<input type="checkbox" name="regsubevt" value="cb_01">cb_01<br>
<input type="checkbox" name="regsubevt" value="cb_02">cb_02<br>
<input type="checkbox" name="regsubevt" value="cb_03">cb_03<br>
<input type="button" value="Show checked" onclick="
showChecked();
"><br>
<textarea name="regsubevtarrayfld" cols="50" rows="20"></textarea>
</form>
 
P

Pasquale

RobG said:
I can only guess that you have something in your HTML that Safari
doesn't like. The following works fine in Safari 1.0.3 (OS X 10.2.8).
There doesn't seem to be anything out of the ordinary with my HTML.

I was wondering if you or someone could go to the link below and tell me
if and what error messages you get, or what you notice happening?

It would be much appreciated!

If you do try it, can you select 2 or 3 events to register for and
submit it? On the next page, which is a form page that you don't need to
fill out, it should list the events you checked off at the top and a
balance owing at the bottom.

Thanks!

https://www.sub10events.com/regselect.php?regtype=i

The link is usually in a window.open without a toolbar, address bar.
 
P

Pasquale

RobG said:
I can only guess that you have something in your HTML that Safari
doesn't like. The following works fine in Safari 1.0.3 (OS X 10.2.8).

FYI...

I got my hands on a Mac and after looking and looking through my code I
noticed it doesn't seem to have anything to do with JavaScript.

When I go to the event selection page with checkboxes to select the
events I want to register for, the submit button has the value of
"Continue" and the name of "request". My PHP script checks for the value
of "request" and produces a form for personal information with the list
of selected events at the top, which it does. The form is to also have a
submit button at the bottom named "request" and the value "Submit".
However, for some reason, Safari will give it the value "Continue". So,
when I submit my personal information with the "Continue" button instead
of "Submit", it produces the form I just filled in again with no list of
selected events, blank fields and this time with the submit button
having the proper value.

By chance, I also noticed that if I reload the personal information form
after it comes up with the wrong submit button value, it will then come
up with the correct value. Of course, that can't be expected. So for now
I have changed the name for the submit button on the event selection
page, and all is fine.

If anyone knows why this is or if it is a Safari bug, please share.

Thanks.
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top