Hello, I am a beginner of writing vbscript and I am now facing a question, my coding as follow - <%
-
dim ID(5)
-
dim value(5)
-
dim count = 5
-
dim i = 0
-
while i<count
-
response.write("<form>")
-
response.write("<input type = checkbox ID = "+ID(i)+" value = "+value(i)+">")
-
response.write(</form>
-
end while
-
%>
The output only displays checkboxs with no value and the checkbox can not be accessed even I check it , is there anything wrong with my coding? And is there any solution (or other method) can satisfy the same situation?
8 16216
I stop using response.write when I have a long section of HTML code, especially if there are a lot of quote marks. I would write it more like this: - <%
-
dim ID(5)
-
dim value(5)
-
dim count = 5
-
dim i
-
for i = 0 to count %>
-
<form>
-
<input type="checkbox" ID="<%=ID(i)%>" value="<%=value(i)%>">
-
</form>
-
<%
-
next %>
Let me know if this helps.
Jared
Thank you for your help, I had tried the coding but the result caused the same problem which the checkbox are displayed with no value, and no response if I checked them
I have got what I want now but face another question -
<%@ Page Language="VB" AutoEventWireup="True" %>
-
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-
<script runat="server" language=vbscript>
-
-
-
Sub Test(ByVal sender As Object, ByVal e As EventArgs)
-
Dim i
-
For i = 0 To 4
-
Dim name = "ID" + i.ToString
-
If name.Checked Then
-
Response.Write(name.Value)
-
End If
-
Next
-
End Sub
-
</script>
-
-
<html >
-
-
<head id="Head1" runat="server">
-
<title> CheckBoxList Example </title>
-
-
</head>
-
-
<body>
-
<form runat="server" action="">
-
<%
-
Dim ID() = {"John", "Peter", "Tom", "Herman", "Mary"}
-
Dim value() = {1, 2, 3, 4, 5}
-
Dim count = 5
-
Dim i
-
For i = 0 To count - 1%>
-
-
<!-- * --><input type="checkbox" id= "<%="ID"+i.tostring%>" value="<%=ID(i).toString%>" runat="server"/> <%=ID(i).ToString()%>
-
-
-
<%
-
next %>
-
<input type ="button" value ="Send" runat ="server" onserverclick="Test" />
-
</form>
-
</body>
-
-
</html>
-
The problem located in the *
the warining message shows it is not allow to use <%%> symbol whether I am using it is runat server
Is there any solution to sort this problem?
Thank you for your help, I had tried the coding but the result caused the same problem which the checkbox are displayed with no value, and no response if I checked them
Well this code doesn't assign a value to the value() array. what values do you want in the value() array?
Jared
The problem located in the *
the warining message shows it is not allow to use <%%> symbol whether I am using it is runat server
Is there any solution to sort this problem?
This looks like a combination of ASP and ASP.NET, the two are not compatible. Are you trying to write ASP (.asp file extension with VBScript) or ASP.NET (.aspx file extension with VB)?
Jared
This looks like a combination of ASP and ASP.NET, the two are not compatible. Are you trying to write ASP (.asp file extension with VBScript) or ASP.NET (.aspx file extension with VB)?
Jared
YUP....I am trying to write asp.net however I am not good at using the interal tools provided, so I try do use vbscript to create the interface. But it seems hard to create the dynamic checkbox.
Well this code doesn't assign a value to the value() array. what values do you want in the value() array?
Jared
the value is dynamic too, as I would like to extract the data from the XML file, such as the title of books in xml document. for example, if there are 2 titles found , there will be a variable called "count" to hold it then using the array to store the values
E.g
count = xmlDoc.SelectNodes("/Books/Book/Title").count<-----I forget whether it is correct
dim values(count)
dim i
for i = 0 to count
'further coding
next
YUP....I am trying to write asp.net however I am not good at using the interal tools provided, so I try do use vbscript to create the interface. But it seems hard to create the dynamic checkbox.
Before we go any further you will need to decide which you are going to use. You can not write ASP.NET with VBScript, you will need to use VB.NET in ASP.NET or VBScript in "classic" ASP. The languages are similar, but not identical. Also, the methods for creating dynamic checkboxes are very different. in ASP.NET you can bind a list of checkboxes to the XML data, but in "classic" ASP you would loop through the XML data and create a new checkbox for each row. Does this make sense?
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics
by: bobby1041 |
last post by:
Hi All!
I am trying to make several fields in a HTML form validated, but only
when a dynamic checkbox is selected. I am not sure how to do this.
Here is a snippet of the dynamic checkbox...
|
by: savvy |
last post by:
I'm comparing two strings and trying to check a dynamic checkbox when
its true on pageload , but i dont know why i'm not able to do that on
page load, when i click some other links and come back to...
|
by: James Wong |
last post by:
Dear Sir,
I want to create some dynamic checkbox controls into the table.
How can I get these controls after the form is submitted.
-----------------------------------------------------
e.g....
|
by: iskyline |
last post by:
hi there,
I'm working with HTA's and vbscripting, and i've managed to get a list of all the text files from a parent folder defined by the user and displayed the information on the HTA window with...
|
by: lucius |
last post by:
Can someone provide a sample of how to add a new CheckBox control to
an ASP.NET page, dynamically completely in code-behind? I am having a
problem understanding which event should handle the...
|
by: Raymond |
last post by:
I am having a problem about the dynamic checkbox
Private Sub Page_Load
Me.NumberOfChkControls = 0
Dim cbCheckBox As New CheckBox
cbCheckBox.Text = .Id.ToString
cbCheckBox.ID = "ControlID_" +...
|
by: iderocks |
last post by:
Hi All,
I created a dynamic checkbox in ASP .Net inside a Button1_Click event method (outside the page_load event) and performed the event handling method for the CheckedChanged event and when I...
|
by: vivek kapile |
last post by:
Title:Dynamically adding table row with a checkbox using JavaScript
Author:Vivek Kapile
Email:snipped
Language:JavaScript
Platform:JavaScript in ASP.net
Technology:Used in ASP.net...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
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...
| |