472,373 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Dynamic Checkboxes Checked Values

Hi. I have an asp page which is connects to an access database from which it loops through a recordset to create a checkbox for each record. I have a script that's suppose to calculate a total value (adds a value when the checkbox is checked and subtracts the value when the checkbox is unchecked) but I keep getting an Error:

Line: 16
Char: 2
Error: Object doesn't support this property or method 'frmEnroll.chkEnroll'
Code: 0
URL: http://www.andreasdancestudio.net/mem_registration.asp


<HTML>
<HEAD>

<LINK REL=StyleSheet HREF="style.css" TYPE="text/css" MEDIA=screen>

<script language="vbscript">
<!--
Public intTotal

Sub Reload_Menu()
parent.frames("menu").location = "menu.asp?page=enrollment&type=mem"
End Sub

Function CalculateTotal(Amount,OptionID)
if frmEnroll.chkEnroll(OptionID).checked then
intTotal = intTotal + Amount
else
intTotal = intTotal - Amount
end if

CalculateTotal = intTotal

End Function

Function DisplayTotal()
DisplayTotal = intTotal
End Function

Sub TextTotal()
frmTotal.txtTotal.value = DisplayTotal()
End Sub
-->
</script>

</HEAD>
<BODY>
<BODY onLoad="Reload_Menu">
<H3 align="center">This page is currently under construction</H3>
<B>

<% if request.cookies("user") = "admin" or request.cookies("user") = "wegga" then %>
<TABLE align="center" border="2">
<TR>
<TD bgcolor="black" align="center" width="110"><a class="off" href="enrollment.asp"><font size="2"><B>Enrollments</B></font></a></TD>
<TD bgcolor="black" align="center" width="110"><a class="off" href="competitions.asp"><font size="2"><B>Competitions</B></font></a></TD>
<TD bgcolor="black" align="center" width="110"><a class="off" href="exams.asp"><font size="2"><B>Exams</B></font></a></TD>
<TD bgcolor="black" align="center" width="110"><a class="off" href="enteruser.asp"><font size="2"><B>Users</B></font></a></TD>
</TR>
</TABLE>
<% end if %>
</B>

<%
'declare variables
Dim objConn, objRec, objRec2
Dim strConnect, sDSNDir
Dim fldField
Dim intStudent
Dim strSQL, strSQL2

'assign values to variables
dsn_name = "access_ads.dsn"
fieldname = "ads.mdb"

'connection information
sDSNDir = Server.MapPath("_dsn")
strConnect = "filedsn=" & sDSNDir & "\" & dsn_name

'set connection and recordset objects
Set objConn = Server.CreateObject("ADODB.Connection")

'open the connection
objConn.Open strConnect
%>

<%
Set objRec = server.CreateObject("ADODB.Recordset")
Set objRec2 = server.CreateObject("ADODB.Recordset")

' get students linked to account
strSQL = "SELECT StudentID, FirstName "
strSQL = strSQL & "FROM Students "
strSQL = strSQL & "WHERE Account ='" & request.Cookies("user") & "';"

'open the recordset for the Students table
objRec.Open strSQL, objConn, 0,1,1
%>

<% while not objRec.EOF %>
<H2><%=objRec("FirstName")%></H2>

<%
' get registered routines
strSQL2 = "SELECT Routines.Routine, Branches.Branch "
strSQL2 = strSQL2 & "FROM Students INNER JOIN ((Branches INNER JOIN Routines ON Branches.BranchID = Routines.Branch) "
strSQL2 = strSQL2 & "INNER JOIN Enrollments ON Routines.RoutineID = Enrollments.Routine) ON Students.StudentID = Enrollments.Student "
strSQL2 = strSQL2 & "WHERE Students.StudentID = " & objRec("StudentID") & ";"

objRec2.Open strSQL2, objConn, 0,1,1
%>

<TABLE align="center" cellspacing="20">
<TR>
<TD valign="top">
<TABLE align="center" border="2" cellpadding="5">
<TR>
<TD colspan="2" bgcolor="#FF0000" align="center"><font color="#FFFFFF"><B>Current Enrollment</B></font></TD>
</TR>
<TR>
<TD class="tbitem">Routine</TD>
<TD class="tbitem">Branch</TD>
</TR>
<% while not objRec2.EOF %>
<TR>
<TD><%=objRec2("Routine")%></TD>
<TD><%=objRec2("Branch")%></TD>
</TR>
<% objRec2.movenext %>
<% wend %>
</TABLE>
<% objRec2.close %>
</TD>

<%
Set objRec2 = server.CreateObject("ADODB.Recordset")

' find routine options for each student in this account
strSQL2 = "SELECT RoutineOptions.RoutineOptionID, RoutineOptions.Routine, "
strSQL2 = strSQL2 & "OptionTypes.Type, OptionTypes.Amount, "
strSQL2 = strSQL2 & "RegistrationOptions.Enroll, "
strSQL2 = strSQL2 & "Branches.Branch "
strSQL2 = strSQL2 & "FROM Branches INNER JOIN ((OptionTypes INNER JOIN RoutineOptions ON OptionTypes.OptionTypeID = "
strSQL2 = strSQL2 & "RoutineOptions.Type) INNER JOIN RegistrationOptions ON RoutineOptions.RoutineOptionID = "
strSQL2 = strSQL2 & "RegistrationOptions.Routine) ON Branches.BranchID = RoutineOptions.Branch "
strSQL2 = strSQL2 & "WHERE RegistrationOptions.Student=" & objRec("StudentID")
strSQL2 = strSQL2 & " ORDER BY OptionTypes.Type;"

objRec2.Open strSQL2, objConn, 0,1,1
%>

<TD valign="top">
<TABLE align="center" cellpadding="5" border="2">
<TR>
<TD colspan="5" bgcolor="#FF0000" align="center"><font color="#FFFFFF"><B>New Season Enrollment</B></font></TD>
</TR>
<TR>
<TD class="tbitem">Routine</TD>
<TD class="tbitem">Branch</TD>
<TD class="tbitem">Type</TD>
<TD class="tbitem">Amount</TD>
<TD class="tbitem">Enroll</TD>
</TR>
<form name="frmEnroll">
<% while not objRec2.EOF %>
<TR>
<TD><%=objRec2("Routine")%></TD>
<TD><%=objRec2("Branch")%></TD>
<TD><%=objRec2("Type")%></TD>
<TD align="right"><%=formatcurrency(objRec2("Amount")) %></TD>

<TD align="center">
<input type="checkbox" value="<%=objRec2("Amount")%>" name="chkEnroll(<%=objRec2("RoutineOptionID")%>)" onClick="Call CalculateTotal(<%=objRec2("Amount")%>,<%=objRec2(" RoutineOptionID")%>)">
</TD>

</TR>
<% objRec2.movenext %>
<% wend %>
</form>
</TABLE>
<% objRec2.close %>
</TD>
</TR>
</TABLE>
<% objRec.movenext %>
<% wend %>

<form name="frmTotal">
<input type="text" name="txtTotal">
<input type="button" name="btnCalculate" value="Calculate" onClick="TextTotal"
</form>

<%
Set objRec = nothing
Set objRec2 = nothing
Set objConn = nothing
%>

</BODY>
</HTML>

Thank you in advance
May 8 '07 #1
0 1456

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Pete | last post by:
There is a Summary/Example further down... On page one of my site I have a form with some checkboxes and detailed descriptions. When the form is submitted (to page two), the values of the...
0
by: Frank Collins | last post by:
Can anyone point me to some good examples on the web of using values from dynamically created checkboxes on forms in ASP, particularly relating to INSERTING those values into a SQL or Access...
1
by: middletree | last post by:
Hate to post this in a separate post, but felt that the last thread was too far down to get noticed. It is called dynamic checkboxes, and it contained some good advice for me, but it led to...
3
by: PABruceFan | last post by:
I am dynamically adding rows to an asp:table as a result of a database query. The row consists of a label, a textbox and three checkboxes in that order: LABEL TEXTBOX CHECKBOX1 CHECKBOX3 ...
34
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript...
1
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem:...
4
by: jedimasta | last post by:
Good evening all, I'm a relatively new to javascript, but I've been working with ColdFusion and PHP for years so I'm not necessarily ignorant, just stuck and frustrated. Using ColdFusion I'm...
0
by: gwilliam | last post by:
Problem with checkboxes in webpages. I am trying to re-set the values of dinamically created checkboxes in a web page, but no matter what I try the "Checked" property is not set correctly. A...
1
by: wissenwill | last post by:
Hello! I need help to modify the following JavaScript: <script language="javascript"> var flds = "chk1,chk2,chk3,chk4".split(",") var vals = new Array(2,4,8,16) var msgs = new Array();
1
by: tamari | last post by:
I have a strange problem changing the checked value of dynamically created checkboxes within code. This is what is happening. Depending what is selected I create checkboxes within a panel. These...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.