473,903 Members | 5,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic Checkboxes Checked Values

4 New Member
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.chkE nroll'
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="vbscr ipt">
<!--
Public intTotal

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

Function CalculateTotal( Amount,OptionID )
if frmEnroll.chkEn roll(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.txtTot al.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="enrollmen t.asp"><font size="2"><B>Enr ollments</B></font></a></TD>
<TD bgcolor="black" align="center" width="110"><a class="off" href="competiti ons.asp"><font size="2"><B>Com petitions</B></font></a></TD>
<TD bgcolor="black" align="center" width="110"><a class="off" href="exams.asp "><font size="2"><B>Exa ms</B></font></a></TD>
<TD bgcolor="black" align="center" width="110"><a class="off" href="enteruser .asp"><font size="2"><B>Use rs</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.CreateOb ject("ADODB.Con nection")

'open the connection
objConn.Open strConnect
%>

<%
Set objRec = server.CreateOb ject("ADODB.Rec ordset")
Set objRec2 = server.CreateOb ject("ADODB.Rec ordset")

' 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.Routin e, Branches.Branch "
strSQL2 = strSQL2 & "FROM Students INNER JOIN ((Branches INNER JOIN Routines ON Branches.Branch ID = Routines.Branch ) "
strSQL2 = strSQL2 & "INNER JOIN Enrollments ON Routines.Routin eID = Enrollments.Rou tine) ON Students.Studen tID = Enrollments.Stu dent "
strSQL2 = strSQL2 & "WHERE Students.Studen tID = " & objRec("Student ID") & ";"

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="#FF000 0" 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.movenex t %>
<% wend %>
</TABLE>
<% objRec2.close %>
</TD>

<%
Set objRec2 = server.CreateOb ject("ADODB.Rec ordset")

' find routine options for each student in this account
strSQL2 = "SELECT RoutineOptions. RoutineOptionID , RoutineOptions. Routine, "
strSQL2 = strSQL2 & "OptionTypes.Ty pe, OptionTypes.Amo unt, "
strSQL2 = strSQL2 & "RegistrationOp tions.Enroll, "
strSQL2 = strSQL2 & "Branches.Branc h "
strSQL2 = strSQL2 & "FROM Branches INNER JOIN ((OptionTypes INNER JOIN RoutineOptions ON OptionTypes.Opt ionTypeID = "
strSQL2 = strSQL2 & "RoutineOptions .Type) INNER JOIN RegistrationOpt ions ON RoutineOptions. RoutineOptionID = "
strSQL2 = strSQL2 & "RegistrationOp tions.Routine) ON Branches.Branch ID = RoutineOptions. Branch "
strSQL2 = strSQL2 & "WHERE RegistrationOpt ions.Student=" & objRec("Student ID")
strSQL2 = strSQL2 & " ORDER BY OptionTypes.Typ e;"

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

<TD valign="top">
<TABLE align="center" cellpadding="5" border="2">
<TR>
<TD colspan="5" bgcolor="#FF000 0" 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">< %=formatcurrenc y(objRec2("Amou nt"))%></TD>

<TD align="center">
<input type="checkbox" value="<%=objRe c2("Amount")%> " name="chkEnroll (<%=objRec2("Ro utineOptionID") %>)" onClick="Call CalculateTotal( <%=objRec2("Amo unt")%>,<%=objR ec2("RoutineOpt ionID")%>)">
</TD>

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

<form name="frmTotal" >
<input type="text" name="txtTotal" >
<input type="button" name="btnCalcul ate" value="Calculat e" onClick="TextTo tal"
</form>

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

</BODY>
</HTML>

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

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

Similar topics

2
3977
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 checkboxes are picked up using $_POST and put into session variables. On page two there is another form which is simply a condensed version of the previous one (titles with no descriptions). The checkboxes are named the same on both forms. When...
0
3745
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 database? Basically, I have a form on which I have a series of statements, with 3 checkboxes for each statement - YES, NO, MAYBE. This series of statements is being dynamically populated from a query of a table in Access, called "tblQuestions". In...
1
1630
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 another question, and I wanted to go ahead and post my question here in hopes of getting an answer. The advice given to me about having a number of checkboxes which are put onto the page from the database, was to name them all the same thing, and...
3
3649
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 CHECKBOX2 name1 email1 checked checked checked name2 email2 not checked checked checked I have no problem adding the dynamic controls...
34
3861
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 function needs to run and validate all the checkboxes on my form and make sure none of them are unchecked. I suck at Javascript and my problem is 2fold. I have the following code that constructs the checkbox response.write "<input type=checkbox...
1
4122
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: I dynamically add an htmlcheckbox to a webform in the pages render and set the checked value to true. When the page loads, if I remove the check from the checkbox and then submit it, in the submit event the checkbox' checked value is still...
4
7272
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 using an include to pull in form elements (text fields, checkboxes, etc...) multiple times on a single page. The included page does not have a form tag of it's own, but the root page has uniquely named forms for validation. Imagine it like this:
0
1204
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 control on the page does a PostBack which in turn calls the following code: strSQL = "usp_TradeShow_GetAllAttendeeClasses_Sel " & lblHiddenUserID.Text & ", " & intSemSchedule dsTempDataSet = wsMain.GetData(strSQL, strdBase, "TSAttendees")...
1
4588
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
2450
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 work very well if I click on them manually, but sometimes I need to check or uncheck some of the checkboxes depending on further input. To change the checkboxes I look at the tag value and from within a loop of the controls. I then can change the...
0
10003
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9851
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10882
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10988
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9692
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5897
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6099
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4312
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.