Current location: Hot Scripts Forums » General Web Coding » JavaScript » Arrays and Clientside Form Collection


Arrays and Clientside Form Collection

Reply
  #1 (permalink)  
Old 01-07-05, 04:43 PM
helorf helorf is offline
New Member
 
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Arrays and Clientside Form Collection

Greetings all. I am trying to develop a function that will add or subtract from a total in an Iframe text box based upon the user's checking or unchecking of a checkbox in the parent page. Here is the vbscript code for the parent page.
Code:
rs.open "exec dispFundingMarkPIFDoc", db
iCount = 0
Do Until rs.EOF
	iCount = iCount + 1
	'sNum = right("000" & iCount,4)
	If iCount = 1 then'sNum = 0001 Then
		response.write "<table width='100%' border=3 background=dc_background.GIF>"
		response.write "	<tr>"
		response.write "		<td colspan=3>"
		response.write "			<Input type=button name=cmdSelectAll value='Select All' class=smallLabelBlack onclick='selectAll()'>"
		response.write "			<Input type=button name=cmdUnSelectAll value='Unselect All' class=smallLabelBlack onclick='unSelectAll()'> "
		response.write "			<span class=SmallMaroon>Selected</span> <Input type=text size=1 Disabled name=ClaimantSelected style='text-align:right' class=SmallMaroon><span class=SmallMaroon> of </span><Input type=text size=1 Disabled name=ClaimantCount style='text-align:right' class=SmallMaroon>"
		response.write "		</td>"
		response.write "	</tr>"
		Response.Write "</table>"
		response.write "<table border=0>"
		response.write "	<tr>"
		response.write "		<td><INPUT TYPE=BUTTON class=SmallLabelBlack VALUE='1. Detail' class=labelblack NAME=cmdDetail onClick='window.open(" & chr(34) & "occFundingDetail.asp?startdate=" & formatdatetime(previousmonday,vbshortdate) & chr(34) & ")'></td>"
		response.write "		<td><INPUT TYPE=BUTTON class=SmallLabelBlack VALUE='2. Summary' class=labelblack NAME=cmdSummary onClick='window.open(" & chr(34) & "SWFundingRequest.asp?traunch=" & sTraunch & chr(34) & ")'></td>"
		response.write "		<td><INPUT TYPE=BUTTON class=SmallLabelBlack VALUE='3. Mark' class=labelblack NAME=cmdMark onClick='Mark()'></td>"
		response.write "	</tr>"
		response.write "</table>"
		Response.Write "<table>"
		response.write "	<tr>"
		response.write "		<td align=center><span class=SmallLabelBlack>Select</span></td>"
		response.write "		<td><span class=LabelBlack>Claim ID</span></td>"
		response.write "		<td><span class=LabelBlack>Doctor Name</span></td>"
		response.write "		<td><span class=LabelBlack>Funding Amount</span></td>"
		response.write "	</tr>"
	End If
	response.write "	<tr>" & chr(13) & chr(10)
	response.write "		<td class=SmallDataBlack align=center>" & chr(13) & chr(10)
	Response.Write "			<Input Type=Checkbox value=1 Name=chk" & iCount & " onclick='incrementDecrementSelectionCount(this); calcDistAmt()';" 
	if request.Form.Count = 0 then
		Response.Write " checked>" & chr(13) & chr(10)
	else	
		Response.Write " >" & chr(13) & chr(10)
	end if	
	Response.Write "	</td>" & chr(13) & chr(10)
	response.write "	<td class=SmallDataBlack>" & rs.Fields("claimid").value '& vbcrlf & vbcrlf & vbcrlf & vbcrlf & iCount
	Response.Write "	<input type='hidden' value='" & rs.fields("claimid").value & "' name='claimid" & iCount & "'></td>"
	response.write "	<td class=SmallDataBlack>" & rs.Fields("DoctorName").value & "</td>"
	Response.Write "	<td class=SmallDataBlack><input type='text' distid=" & rs.Fields("distid").Value & " name='txtAmount'" & iCount & " value='" & formatcurrency(rs.Fields("amount").Value,2) & "' size='3' style='BORDER-TOP-STYLE:none;BORDER-RIGHT-STYLE:none;BORDER-LEFT-STYLE:none;BORDER-BOTTOM-STYLE:none' disabled></td>"
	response.write "</tr>" & chr(13) & chr(10)
	rs.MoveNext
Loop
if iCount then
	Response.Write "<tr height='250px'><td colspan=4><iframe width='500px' height='100%' src='occFundingValidate.asp?' id='validation' name='validation'></iframe></td></tr>"
	response.write "</table>"
In the child page, the Iframe each amount is linked to the parent page by an ID field. In the Iframe the fields are cosolidated totals of each persons total. When the user checks or unchecks the checkbox on the parent page it needs to change the value in the child page. Also here is my function so far.
Code:
function calcDistAmt() {
		for(i=0; i<document.frmMarkDocPaid.elements.length; i++) {
			if (document.frmMarkDocPaid.elements[i].name.substring(0,9)=="txtAmount") {
					arrDist[document.frmMarkDocPaid.elements[i].distid]=arrDist[document.frmMarkDocPaid.elements[i].distid]+ ',' + document.frmMarkDocPaid.elements[i].value;
			}	
		}
	}
Also forgot to tell you this is in ASP3.0 Can you help please?

Last edited by helorf; 01-07-05 at 04:51 PM.
Reply With Quote
  #2 (permalink)  
Old 01-08-05, 10:10 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
You have not specified a specific problem and I can't test the code since that requires the complete source.
However I noted that you are using an array named arrDist in the calcDistAmt() function which is not created anywhere...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 10:37 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.