script not working in Safari

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pasquale

    #1

    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 submitcntiselec t = 0;
    function SubmitChkIselec t () {
    var formobj = document.forms['iregevtslct'];
    var subevtobj = formobj.element s['regsubevt'];
    if (submitcntisele ct == 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.eleme nts['allsprints'].checked) ||
    ((subevtobj[0].checked) && (subevtobj[1].checked) &&
    (subevtobj[2].checked))) {
    formobj.element s['series'].value = 1;
    }
    }
    formobj.element s['regsubevtarray fld'].value = regsubevtarray;
    if (choicecount == 0) {
    alert('Please select at least one event.');
    return false;
    }
    submitcntiselec t++;
    return true;
    } else {
    alert('This form has already been submitted. Please wait...');
    return false;
    }
    }
    //--End-->

  • Fred Oz

    #2
    Re: script not working in Safari

    Pasquale wrote:[color=blue]
    > 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.[/color]

    But where is the associated HTML?

    --
    Fred

    Comment

    • Fred Oz

      #3
      Re: script not working in Safari

      Pasquale wrote:[color=blue]
      > 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 submitcntiselec t = 0;
      > function SubmitChkIselec t () {
      > var formobj = document.forms['iregevtslct'];
      > var subevtobj = formobj.element s['regsubevt'];[/color]

      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...
      [color=blue]
      > if (submitcntisele ct == 0) {
      > var choicecount = 0;
      > var regsubevtarray = new Array();
      > for (var i = 0; i <= 4; i++) {
      > if (subevtobj[i].checked) {[/color]

      if (formobj.regsub evt[i].checked) {

      or more formally

      if (formobj.elemen ts['regsubevt'][i].checked) {
      [color=blue]
      > choicecount++;
      > regsubevtarray. push(subevtobj[i].value);[/color]
      [color=blue]
      > regsubevtarray. push(formobj.re gsubevt[i].value);[/color]
      ...

      etc.

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


      --
      Fred

      Comment

      • Pasquale

        #4
        Re: script not working in Safari

        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:[color=blue]
        > Pasquale wrote:
        >[color=green]
        >> 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 submitcntiselec t = 0;
        >> function SubmitChkIselec t () {
        >> var formobj = document.forms['iregevtslct'];
        >> var subevtobj = formobj.element s['regsubevt'];[/color]
        >
        >
        > 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...
        >[color=green]
        >> if (submitcntisele ct == 0) {
        >> var choicecount = 0;
        >> var regsubevtarray = new Array();
        >> for (var i = 0; i <= 4; i++) {
        >> if (subevtobj[i].checked) {[/color]
        >
        >
        > if (formobj.regsub evt[i].checked) {
        >
        > or more formally
        >
        > if (formobj.elemen ts['regsubevt'][i].checked) {
        >[color=green]
        >> choicecount++;
        >> regsubevtarray. push(subevtobj[i].value);[/color]
        >
        >[color=green]
        > > regsubevtarray. push(formobj.re gsubevt[i].value);[/color]
        > ...
        >
        > etc.
        >
        > Referencing form elements this way should not create problems in
        > any other browser that supports the forms collection.
        >
        >[/color]

        Comment

        • Fred Oz

          #5
          Re: script not working in Safari

          Pasquale wrote:[color=blue]
          > 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?[/color]
          [...]

          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

          Comment

          Working...