![]() |
Clientside CheckBox validation
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[i].checked) { if(checked_count==0) { chk_vid_comma_string=chk_vid_comma_string + vObj_vid[i].value } else { chk_vid_comma_string=chk_vid_comma_string + "," + vObj_vid[i].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. |
Re: Clientside CheckBox validation
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" <apey@slingshot.co.nz> wrote in message news:1162456301.999331.11790@h48g2000cwc.googlegro ups.com... >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[i].checked) > { > if(checked_count==0) > { > chk_vid_comma_string=chk_vid_comma_string + vObj_vid[i].value > } > else > { > chk_vid_comma_string=chk_vid_comma_string + "," + vObj_vid[i].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. > |
| All times are GMT. The time now is 03:20 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.