|
 |
access_asp thread: retieving the state of the checkbox in an array of forms.
Message #1 by "Nitin Chadha" <nchadha1@r...> on Tue, 18 Sep 2001 08:49:16
|
|
I'm generating multiple forms in ASP, using VB Script. In the form, I've
made a ckeckbox named C. Now, I want to check whether the checkbox is
checked or not. To acheive this, I am using the following code:
<%@ language=VBScript%>
<%
'This code replicates the form 5 times, displaying a checkbox. The name of
the from will be F1, F2.....F5.
for i=1 to 5%>
<form name="F<%=i%>" method="POST">
<Input type="Checkbox" name="C">
</form>
<%next
'This code is to check the state of the checkboxes.
for x=0 to 5
if document.F<%=x%>.C.checked then
msgbox (x+" th checkbox is checked.")
end if
next
%>
Please tell me where is the error and provide the appropriate sol. for the
same.
Message #2 by "Zee Computer Consulting" <zee@t...> on Tue, 18 Sep 2001 11:08:13 -0700
|
|
Shouldn't that be:
FOR x=1 TO 5
instead of starting at zero?
Also, I would use the ampersand instead of the plus sign for string
concatenation:
msgbox (x & " the checkbox is checked.")
-- Zee
----- Original Message -----
From: "Nitin Chadha" <nchadha1@r...>
To: "Access ASP" <access_asp@p...>
Sent: Tuesday, September 18, 2001 8:49 AM
Subject: [access_asp] retieving the state of the checkbox in an array of
forms.
> I'm generating multiple forms in ASP, using VB Script. In the form, I've
> made a ckeckbox named C. Now, I want to check whether the checkbox is
> checked or not. To acheive this, I am using the following code:
>
> <%@ language=VBScript%>
> <%
> 'This code replicates the form 5 times, displaying a checkbox. The name of
> the from will be F1, F2.....F5.
>
> for i=1 to 5%>
> <form name="F<%=i%>" method="POST">
> <Input type="Checkbox" name="C">
> </form>
> <%next
>
> 'This code is to check the state of the checkboxes.
> for x=0 to 5
> if document.F<%=x%>.C.checked then
> msgbox (x+" th checkbox is checked.")
> end if
> next
> %>
>
> Please tell me where is the error and provide the appropriate sol. for the
> same.
>
|
|
 |