Clientside CheckBox validation

Discussion in 'ASP .Net' started by oakura_ape, Nov 2, 2006.

  1. oakura_ape

    oakura_ape Guest

    I have inherited a site that I have ported to ASP.Net 2.0 within the
    site I have a checkbox in a datalist ItemTemplate as such:
    <TD width="4%"><INPUT class="rach" id="chk_vid" type="checkbox"
    name="chk_vid" value="<%#container.dataitem("vid")%>"
    runat="server"></TD>

    There is some client side validation done on some button presses like
    below. It works fine in IE but in fire fox you only ever get an
    evaluation returning true if the checkbox in the first item row is
    checked

    function send_email_submit()
    {
    vObj_vid=document.all.chk_vid
    checked_count=0
    chk_vid_comma_string=""
    if(vObj_vid.length==undefined)
    {
    if(vObj_vid.checked==true)
    {
    chk_vid_comma_string=chk_vid_comma_string + vObj_vid.value
    checked_count=checked_count+1
    }
    }
    for(i=0;i<vObj_vid.length;i++)
    {
    if(vObj_vid.checked)
    {
    if(checked_count==0)
    {
    chk_vid_comma_string=chk_vid_comma_string + vObj_vid.value
    }
    else
    {
    chk_vid_comma_string=chk_vid_comma_string + "," + vObj_vid.value
    }
    checked_count=checked_count+1
    }
    }
    if(checked_count>0)
    {
    document.form2.vid.value=chk_vid_comma_string
    document.form2.action="send-email.aspx?return_type=1"
    document.form2.submit();
    }
    else
    {
    alert("Please specify venue.")
    return false;
    }
    }


    Any ideas on where the problem lies would be much appreciated.
     
    oakura_ape, Nov 2, 2006
    #1
    1. Advertising

  2. oakura_ape

    Onwuka Emeka Guest

    Firefox would not understand document.all use document.getElementById
    instead. when you load the page, you can select Tools -> JavaScrip Console
    on the firefox menu, it would give you
    details of you javascript errors.



    "oakura_ape" <> wrote in message
    news:...
    >I have inherited a site that I have ported to ASP.Net 2.0 within the
    > site I have a checkbox in a datalist ItemTemplate as such:
    > <TD width="4%"><INPUT class="rach" id="chk_vid" type="checkbox"
    > name="chk_vid" value="<%#container.dataitem("vid")%>"
    > runat="server"></TD>
    >
    > There is some client side validation done on some button presses like
    > below. It works fine in IE but in fire fox you only ever get an
    > evaluation returning true if the checkbox in the first item row is
    > checked
    >
    > function send_email_submit()
    > {
    > vObj_vid=document.all.chk_vid
    > checked_count=0
    > chk_vid_comma_string=""
    > if(vObj_vid.length==undefined)
    > {
    > if(vObj_vid.checked==true)
    > {
    > chk_vid_comma_string=chk_vid_comma_string + vObj_vid.value
    > checked_count=checked_count+1
    > }
    > }
    > for(i=0;i<vObj_vid.length;i++)
    > {
    > if(vObj_vid.checked)
    > {
    > if(checked_count==0)
    > {
    > chk_vid_comma_string=chk_vid_comma_string + vObj_vid.value
    > }
    > else
    > {
    > chk_vid_comma_string=chk_vid_comma_string + "," + vObj_vid.value
    > }
    > checked_count=checked_count+1
    > }
    > }
    > if(checked_count>0)
    > {
    > document.form2.vid.value=chk_vid_comma_string
    > document.form2.action="send-email.aspx?return_type=1"
    > document.form2.submit();
    > }
    > else
    > {
    > alert("Please specify venue.")
    > return false;
    > }
    > }
    >
    >
    > Any ideas on where the problem lies would be much appreciated.
    >
     
    Onwuka Emeka, Nov 2, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eddie Dodd

    Clientside validation not working

    Eddie Dodd, May 26, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    471
    Eddie Dodd
    May 27, 2004
  2. Dennis Calla

    Clientside validation not working.

    Dennis Calla, Jan 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    433
    Peter Blum
    Jan 13, 2005
  3. Paul
    Replies:
    1
    Views:
    2,096
    Scott Allen
    May 25, 2005
  4. Kris
    Replies:
    1
    Views:
    611
    Peter Blum
    Jun 30, 2005
  5. tshad

    Setting Checkbox clientside

    tshad, Dec 2, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    530
    tshad
    Dec 2, 2005
Loading...

Share This Page