Professional Web Applications Themes

DOM scriptiing - Macromedia Dynamic HTML

Hi Guys, I'm trying to validate my form and loop thorugh each checkbox to see if it has been checked. My html is below, Im trying to get the length of the checkbox array by using: alert(doent.form.transport.length); However, it keeps saying it has no properties, can anyone please help? Thankyou <ffform name="form" action="#" method="post" onSubmit="return CheckFieldBlank()"> <input id="Bycycle" type="checkbox" name="transport" value="Bycycle" /> <input id="Motorscooter" type="checkbox" name="transport" value="Motorscooter" /> <input id="Motorbike" type="checkbox" name="transport" value="Motorbike" /> <input id="Car" type="checkbox" name="transport" value="Car" /> </form>...

  1. #1

    Default DOM scriptiing

    Hi Guys,

    I'm trying to validate my form and loop thorugh each checkbox to see if it has
    been checked. My html is below, Im trying to get the length of the checkbox
    array by using:

    alert(doent.form.transport.length);

    However, it keeps saying it has no properties, can anyone please help?

    Thankyou



    <ffform name="form" action="#" method="post" onSubmit="return
    CheckFieldBlank()">
    <input id="Bycycle" type="checkbox" name="transport" value="Bycycle" />
    <input id="Motorscooter" type="checkbox" name="transport"
    value="Motorscooter" />
    <input id="Motorbike" type="checkbox" name="transport"
    value="Motorbike" />
    <input id="Car" type="checkbox" name="transport" value="Car" />
    </form>

    Mattastic Guest

  2. #2

    Default Re: DOM scriptiing

    Is this a typo?

    <ffform name="form"

    --
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs, Tutorials & Resources
    ==================


    "Mattastic" <com> wrote in message
    news:fuq21c$7jn$macromedia.com... 

    Murray Guest

  3. #3

    Default Re: DOM scriptiing

    Not in my code, I quickly typed up this post.

    Thanks
    Mattastic Guest

  4. #4

    Default Re: DOM scriptiing

    Mattastic wrote: 
     
     
    "form" is a reserved word in js, I recommend you not use it.
    <body>
    <script>
    function CheckFieldBlank(form){
    var a=form.transport.length,b=[];
    alert(a);
    while(a--){
    if(form.transport[a].checked)b.push(form.transport[a].value)
    }
    if(b.length) {
    alert("These checked:\n"+b.join("\n"));return true;
    }
    alert("none checked");return false;
    }
    </script>
    <form name="f" action="#" method="post"
    onsubmit="return CheckFieldBlank(this)">
    <input id="Bycycle" type="checkbox" name="transport"
    value="Bycycle">
    <input id="Motorscooter" type="checkbox" name="transport"
    value="Motorscooter">
    <input id="Motorbike" type="checkbox" name="transport" value="Motorbike">
    <input id="Car" type="checkbox" name="transport"
    value="Car">
    <input name="smit" type="submit" value="go">
    </form>
    </body>

    Mick
    Mick Guest

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139