Onclick return function malfunctioning in IE

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

    Onclick return function malfunctioning in IE

    Hi guys,

    <input class="btn" type="submit" name="terminate " value="Terminat e"
    onclick="return check_proc_sel( )" />

    i have returned false from check_proc_sel( ) but still the form's
    submit event is called
    It works properly in Firefox but not in IE.
    solutions???

    regards,
    vimal
  • SAM

    #2
    Re: Onclick return function malfunctioning in IE

    vimal a écrit :
    Hi guys,
    >
    <input class="btn" type="submit" name="terminate " value="Terminat e"
    onclick="return check_proc_sel( )" />
    >
    i have returned false from check_proc_sel( ) but still the form's
    submit event is called
    It works properly in Firefox but not in IE.
    solutions???
    Je ne suis pas devin !

    Without knowing what dooes the function : no solution !
    If something in the function stops it in error whith IE, probably
    'false' is not returned ?

    always to prefer the solution in form tag

    <form onsubmit="retur n check_proc_sel( )" blah >
    ....
    <input type=submit class="btn" value="Terminat e">
    </form>

    --
    sm

    Comment

    • Evertjan.

      #3
      Re: Onclick return function malfunctioning in IE

      SAM wrote on 24 jul 2008 in comp.lang.javas cript:
      <input type=submit class="btn" value="Terminat e">
      >
      OT, but according to Dr Who it should be:

      <form action='http://www.youtube.com/watch?v=c4UJiBm VEMk'>
      <input type=submit class="Dalek" value="Extermin ate">
      </form>

      --
      Evertjan.
      The Netherlands.
      (Please change the x'es to dots in my emailaddress)

      Comment

      • vimal

        #4
        Re: Onclick return function malfunctioning in IE

        The function is as follows:

        function check_proc_sel( ){
        var field = document.procs. process_checked ;
        var count = 0;
        for (i=0;i&lt;field .length;i++){
        if (field[i].checked==true) {
        count += 1;
        }
        }
        if (count == 0){
        alert("No process selected to Terminate or Kill")
        return false;
        }
        else{
        return true;
        }
        }

        vimal

        Comment

        • SAM

          #5
          Re: Onclick return function malfunctioning in IE

          vimal a écrit :
          The function is as follows:
          Try :

          function check_proc_sel( ){
          var field = document.procs. process_checked ;
          if(typeof field == 'undefined')
          {
          alert('no such field');
          return false;
          }
          var count = 0;
          for (i=0, n = field.length; i<n; i++)
          {
          if (field[i].checked) count++;
          }
          if (count == 0)
          {
          alert("No process selected to Terminate or Kill")
          field.focus();
          return false;
          }
          return true;
          }


          And use the onsubmit in tag form
          instead of onclick in submit button

          --
          sm

          Comment

          • vimal

            #6
            Re: Onclick return function malfunctioning in IE

            On Jul 24, 1:33 pm, SAM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
            wrote:
            vimal a écrit :
            >
            The function is as follows:
            >
            Try :
            >
            function check_proc_sel( ){
            var field = document.procs. process_checked ;
            if(typeof field == 'undefined')
            {
            alert('no such field');
            return false;
            }
            var count = 0;
            for (i=0, n = field.length; i<n; i++)
            {
            if (field[i].checked) count++;
            }
            if (count == 0)
            {
            alert("No process selected to Terminate or Kill")
            field.focus();
            return false;
            }
            return true;
            }
            >
            And use the onsubmit in tag form
            instead of onclick in submit button
            >
            --
            sm
            IE script debugger shows error in the following line

            line ===field.focus( );
            error ===object doesn't support this property

            vimal

            Comment

            • SAM

              #7
              Re: Onclick return function malfunctioning in IE

              vimal a écrit :
              On Jul 24, 1:33 pm, SAM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
              wrote:
              >>
              >function check_proc_sel( ){
              > var field = document.procs. process_checked ;
              > if(typeof field == 'undefined')
              > {
              > alert('no such field');
              > return false;
              > }
              > var count = 0;
              > for (i=0, n = field.length; i<n; i++)
              > {
              > if (field[i].checked) count++;
              > }
              > if (count == 0)
              > {
              > alert("No process selected to Terminate or Kill")
              > field.focus();
              > return false;
              > }
              > return true;
              > }
              >
              IE script debugger shows error in the following line
              >
              line ===field.focus( );
              error ===object doesn't support this property
              doesn't understand that IE didn't display the message
              "not such field" ? !

              is(are) this(these) 'process_checke d' is(are) checkbox(es) ?

              try :

              alert ("No process selected to Terminate or Kill");
              if(field[0]) field[0].focus();
              return false;



              --
              sm

              Comment

              • beegee

                #8
                Re: Onclick return function malfunctioning in IE

                On Jul 24, 3:31 am, vimal <cool.vimalsm.. .@gmail.comwrot e:
                Hi guys,
                >
                <input class="btn" type="submit" name="terminate " value="Terminat e"
                onclick="return check_proc_sel( )" />
                >
                i have returned false from check_proc_sel( ) but still the form's
                submit event is called
                It works properly in Firefox but not in IE.
                solutions???
                >
                regards,
                vimal
                Is it neccessary to do it this way?

                How about:
                <form ..... onsubmit="check _proc_sel()">
                ...
                </form>

                <script type='text/javascript'>
                function check_proc_sel( )
                {
                I'm checkin but I don't like what I find so...
                return false;
                }
                </script>

                Bob

                Comment

                Working...