Clientside CheckBox validation

O

oakura_ape

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.
 
O

Onwuka Emeka

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top