473,383 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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.

Nov 2 '06 #1
1 1520
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" <ap**@slingshot.co.nzwrote in message
news:11*********************@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.

Nov 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lofty | last post by:
I want to validate client entries into textbox,checkbox controls etc. can u do this with asp. Like, is there onchange and onclick and so on for these controls? is there a reference for this in...
2
by: Niclas Lindblom | last post by:
Hi, I have a datagrid with linkbuttons. I would like to catch the click event when a link button has been clicked and use the string from the text value of the link button in a clientside Java...
4
by: TJS | last post by:
how do I get "onSubmit" to work in .net ? <Form id="Form1" name="Form1" method="post" onSubmit="return validateStandard(this, 'error');" runat="server">
1
by: Paul | last post by:
Hi Guys and Girls I am trying to disable the clientside validation (Required Fields) by using the ValidatorEnable(id,false), which works find from the point of view that the client side script...
1
by: Kris | last post by:
Hi, I have a DataGrid where in each row has couple of text boxes and an update button. Each row is dynamically generated as the number of rows are not known ahead of time. When the user clicks the...
1
by: MattC | last post by:
I have a user control that contains several requiredFieldValidators. The page the control sits in has other RequiredFieldValidators. On submitting the form all the validators on the page fire and...
3
by: Jon Paal | last post by:
using VWD and asp.net 2.0 how do I enable clientside validation in ligin control ? Following code does not produce popup alerts or red asterisks . ==================== <div id="content">...
2
by: tshad | last post by:
I am trying to set and clear my checkboxes using client-side validation. I have some Javascript to set my checkboxes: <script language=javascript> function validate(){ Medical.checked = 1; }...
7
by: mc | last post by:
I've not been able to get a Check box to client side validated on postback. with my changes I can get it to work on the serverside ok but not on the client. I have created a new control as...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.