how to display message if none of the checkbox is selected

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mukeshrasm
    Contributor
    • Nov 2007
    • 254

    #16
    Originally posted by Dormilich
    of course you can, but the disadvantage is that you have to compute the array length every time anew, while the first one computes the length only once.

    and another one: use count_var < array_length (as terminating condition), otherwise you'll access a non-existing element, which may cause your script to break
    Hi

    Reference to post #7 I want to find the number of checkboxes in the form. I gave id to checkbox "checkdel" and to that I used like this

    Code:
    var ch=document.getElementById("checkdel")
    var chh=ch.length
    alert(chh)
    but it is showing as 'undefined'.

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #17
      of course. a HTMLInputElemen t (and its parent interface HTMLElement) does not have a length property (why should it, you know that there is only one).
      Last edited by Dormilich; Mar 27 '09, 10:36 AM. Reason: corrected object type

      Comment

      • mukeshrasm
        Contributor
        • Nov 2007
        • 254

        #18
        Originally posted by Dormilich
        of course. a HTMLElementNode does not have a length property (why should it, you know that there is only one).
        actually I am doing it dynamically using php

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #19
          I guess you'll have to check it in PHP anyways.....

          Comment

          • mukeshrasm
            Contributor
            • Nov 2007
            • 254

            #20
            Originally posted by Dormilich
            I guess you'll have to check it in PHP anyways.....
            ok thanks! but I am not sure what will be title of my posting or how can I reference my this posting to php

            Comment

            • Dormilich
              Recognized Expert Expert
              • Aug 2008
              • 8694

              #21
              you can always put a link to this thread in your question.

              although I don't understand why you've given up on this little script. you've nearly had it finished...

              advice for PHP : if you name your checkboxes like name="checkbox_ name[]" all the checkboxes bearing this will be put into an array.

              some further reading on HTML DOM object types:HTML IDL Definitions (these tell you, which methods and properties are available from the DOM side)
              Last edited by Dormilich; Mar 27 '09, 10:42 AM. Reason: added IDL info

              Comment

              • mukeshrasm
                Contributor
                • Nov 2007
                • 254

                #22
                Originally posted by Dormilich
                you can always put a link to this thread in your question.

                although I don't understand why you've given up on this little script. you've nearly had it finished...

                advice for PHP : if you name your checkboxes like name="checkbox_ name[]" all the checkboxes bearing this will be put into an array.

                some further reading on HTML DOM object types:HTML IDL Definitions (these tell you, which methods and properties are available from the DOM side)
                Thanks for encouraging words and I am trying.

                Comment

                Working...