Create An Array Of Checkboxes
how to create an array of checkboxes for a dynamic table. I want the checkboxes to display on the left of the table. When the checkbox is selected the user will select delete, edit, or update.
View Replieshow to create an array of checkboxes for a dynamic table. I want the checkboxes to display on the left of the table. When the checkbox is selected the user will select delete, edit, or update.
View RepliesI am developing this web application where users may go through a number of steps to "build their product". This is all done with session variables to hold the input until submitted. The way I have it right now,
There is about 16 checkboxes, all with the same name "checkbox" (for simplicity) Each has a different id and different value.
The user may only choose 3. The values from these get stored in a comma deliminated string: ie. about, testimonies, services.
(I am trying to avoid setting a variable for each checkbox to be equal to, which I tried and it didn't work.)
If the user goes back to the page if they change their mind I want the appropriate checkboxes to be checked.
Right now I have the string being split up into an array. I have tried setting the array values to variables, then I tried setting these equal to another specific variable only for that checkbox..blah,blah, blah.
Here is my code, very similar to someone's on the forums (which I have been going through with a fine tooth comb, ; turns out their thread was never answered).
This code gets the first array item and checks the right checkbox but no the other 2.
<%
menuarray = Split(Session("checkbox"),",")
for i = LBound(menuarray) to UBound(menuarray)
'currentCardType = ""
response.write " " & i & " = " & menuarray(i) & "<br>"
next
' because there is only 3 for sure, I just used 0-2 rather than i for the following.
' I have the following three times in my code, for the 3. Tried it with just "i" and within the loop but didn't work
if CStr(menuarray(0)) = CStr("Welcome") then
vWelcome = "checked"
elseif CStr(menuarray(0)) = CStr("About Us") then
vAbout = "checked"
elseif CStr(menuarray(0)) = CStr("Message from the President") then
vMessage = "checked"
elseif CStr(menuarray(0)) = CStr("Products and Services") then
vProducts = "checked"
elseif CStr(menuarray(0)) = CStr("Our Services") then
vServices = "checked"
elseif CStr(menuarray(0)) = CStr("Curriculum") then
vCurriculum = "checked"
elseif CStr(menuarray(0)) = CStr("Testimonials") then
vTestimonials = "checked"
elseif CStr(menuarray(0)) = CStr("Student Life") then
vStudentlife = "checked"
elseif CStr(menuarray(0)) = CStr("Apply Now") then
vApply = "checked"
elseif CStr(menuarray(0)) = CStr("Case Studies") then
vCasestudies = "checked"
elseif CStr(menuarray(0)) = CStr("Catalog") then
vCatalog = "checked"
end if
.....
how can I create a array of record
example:
I want to create a array of employees,and each array I have the name and age of the employee:
employees
+------------------------------------------+
|name: ze |name: ma |name: ro |name: car |
| age: 20 | age: 25 | age: 22 | age: 23 |
+------------------------------------------+
I want to create a new array called arrNames2 and copy contents of arrNames to arrNames2.
I then want to loop through my db and add more names (while going through the loop) to arrNames2. What is the best way to do this? Do I have to keep redim the array wehn I add more names?
I am trying to find distinct hostname. And my code is:
sql="select distinct a.Hostname, b.Productname from TableInventory as a, TableProduct as b, TableModel as c WHERE a.ModelId=c.Model AND c.ProductId=b.ProductId"
rs.open sql, cnn
After which im suppose to get the indivual hostname's productname, qty and cost.
i tried to split up the rs into array values Code:
Here's what I have:
quiz.asp?done=6|3|2
my asp code:
done = request.querystring("done")
Now, if I response.write done
I get 6|3|2
However, I want to create an array of 6|3|2 ???
How can I create an array with no specified size. I tried to do the following with no luck
Dim my_array()
The code will be adding values to the array like this
my_array(i) = "First"
.
.
.
etc
I have a textfile that I'd like to put into an Array using VBS. The text file has over 6200 entries. Is it possible to put those entries into an array automatically using VBS? So far all the resources I've looked at show manual creation of the array.
View Replies View RelatedI code that creates a calendar for each month and then it displays events from that month that are stored in a db. I need to loop through my recordset and display all the events, but I can't quite figure out how to do it. I am thinking I need to do an array. But I am not really sure.... any ideas. Here is where you can view the calendar. Code:
View Replies View RelatedHere's what my code looks like...
View Replies View RelatedI dump the entire recordset into an array:
If not rs.EOF Then
aEmp = rs.GetRows()
Contents of the array are in this order:
EmpID,EmpName,Indent,Sub_ID,Lft,Rgt,MgrID, LastName
This query sort on the basis of Lft and Rgt columns.
The name of the array is: aEmp.
My question here is how can I get only the LastName from the aEmp array into another array so that I can sort the names alphabetically and then display the employees in the alphabetical order.
Or is there is another way I could this by using the same array while keeping the lft and rgt sort of the query? If I sort based at the SQL query level, I can see the names sorted by the lft, rgt and lastname, but since the lastname is at the end of the sort list - it does not appear alphabetically.
In working with arrays, I have found that I am unable to dimension and array
with a variable that has an integer value but I can redimension one this
way. I haven't see any information that tells me if this is a requirement,
although it appears to be because I get an error if I try it.
Ex.
Dim b
b = 10
Dim a(b) ' this errors out but
Dim a() ' this
Redim a(b) ' works
Code:
I have a form that has checkboxes. I would like when the user clicks the
process button the next page will display the value of the boxes that were
checked.
Do any of you guys know what the value of a check box is.
I am offering two ways to download, posting to a diff form and using info from there but do not know which check box has been ticked??
To get the checked value of checkboxes I use this code:
Code:
For Each subitem In oFileUp.FormEx("imgCheckBox")
...
Next
How can I get the value of those unchecked checkboxes?
I am trying to set up a page, with some input fields, which
are mandatory. Then there is a checkbox, when it is
checked, the input fields do not need to be filled
(not mandatory anymore). At the moment, even though
the checkbox is checked it asks to fill the mandatory
fields.
I need to add a master checkbox, clicking on which, will select all the child checkboxes. Unclicking it, will unselect all the child boxes.
Exactly the same way as hotmail does. I know, I need to write a javascript for that. But the problem is, the child checkboxes are being
populated from the stylesheet code (embedded in the .asp page). It is also not under the <form> </form> tag. Following is the code:
I've never used checkboxes in ASP, well nows the time i do it.Im creating a login script, and want the user to be able to click on "remember me"it keep them logged in.
how would i get that in ASP. how would i make it detect wether or not the checkbox has been selected or not?
I'm trying to create a form that has checkboxes on it that when a user checks the particular boxes, and submits the form, it performs the query based on the selections.
I'm using MS Access and FrontPage. I'm having problems passing the information from the form to the query and then to the database.
How can I use checkboxes to send out an email based on which checkbox was clicked?
For example, I have an html table that is constructed dynamically which contains information about events stored in a database.
The table has checkboxes out to the left side (similar to hotmail) and when I check however many boxes, and click submit, I want to send an email to each address that is associated with each record that I checked its box.Something like "for each checkbox clicked, select the ID and email address associated with it, and dispatch an email"
I have everything set up except the asp loop and select statement that will help me achieve this.
i have some 15 checkboxex on a form... i want to 1st check the no. of checkboxes that are checked?? and then loop it that many times adn insert the quantities the user enters in the text boxes.
do i need to group the checkboxes....hwo can i do that??? how to know which checkbox is checked because out of the 15 checkbox say 1,5,7, 9th are checked then i 1st need to get the id from the database adn then based on htat id retrieved i need to insert values on another table.
give me a working example on how to use checkboxes ?
View Replies View RelatedA list of names is printed out from a Table as a list of checkboxes:
<tr>
<%while not rstLogin.EOF%>
<%
dim name
name =rstLogin.Fields(0)%>
<td><input type="checkbox" name="<%=name%>" > <%Response.write (name)%> </td>
</center>
</tr>
<%
rstLogin.MoveNext
wend
What I then want to do is add "Checked" names to another table. How do I do this?
I've been using Dreamweaver to develop some simple database connectivity. So far everything works, but could be more user-friendly and flexible.
I have an Access database with 4 document types. I have search forms which allow users to enter a keyword and search for one specific document type. The problem is I need four different search forms this way. What I would like is to include 4 checkboxes and one keyword textfield. Code:
I have a page with checkboxes which are created from a database as below:
<% while not rs.eof %>
<%=rs("contract_name")%><input type="checkbox" name="<%=rs("contract_name")%>"><br>
<%
rs.MoveNext
wend%>
I need to be able to tell which ones are checked on the next page. How do i do this when they all have automatically generated names?
I have a series of dynamcially named and id'd checkboxes. each one has the same name but its id value is different. The ID value tells me which checkbox relates to a particular record in a recordset. I need to obtain the id of the checkbox and its value - so far I can only get the value as follows :
<%
For x=1 To request.form("BillNumCheckBox").Count
aSelected = request.form("BillNumCheckBox").Item(x)
response.write x & " = " & aSelected & "<BR>"
Next
%>
I have two related tables in my database. One stores events and the other stores a list of key topics.
I have an interface set up where users can add / edit events.
In the add event page, I am querying the "key topics" table and returning them as options (array of checkboxes). The user makes their pick, and submits. All the data saves in the 'event" table, including the primary id of the "topics".
That part works great. The problem I am having is when the EDIT event page resolves, I am trying to "check" the options that were previously saved.
First thing I do (at the top of the page) is to query the events table to pull all of the data out. I use the 'events" table to do this.
For the checkboxes, I am once again looping through them in a query that uses the "key topics" table. So the boxes are displayed, but I can't seem to get the logic right to have the appropriate ones checked. here is my current code:
I Have this form in page1:
<form method="post" action="page2.asp">
<input type="checkbox" name="numb" value="10">
<input type="checkbox" name="numb" value="20">
<input type="checkbox" name="numb" value="30">
<input type="checkbox" name="numb" value="40">
</form>
Now what I want is to add the checked values in page2.
For example :
if checkbox1 and checkbox3 gets checked I want to add the values in the
checkboxes which in this case is 10 + 30 and get the total sum (40).
Hope this makes sense?
So how do I retrive the checked values and then add the checked values
with eachother to get the total?
The problem I have is that I need to save the content of a form in a database, and I donw know how to save the content of a checkbox, can you give me an example of the code?
View Replies View Relatedat the moment i am creating a shopping cart of sorts. Simply the user selects the check boxes of the items he wants and clicks submit. The items are dynamically created and they could select anything from 1 to 100 items..
so processing the form is clear not possible by hard coding. How could i read all the values from the POST into an array instead of processing each item at a time.
I'm writing an Online registration system for my friends new business.
I'm trying to incorporate checkboxes so when a person checks on 3 or 4 checkboxes and hits the Submit button I can
pass the information of what they checked_on to a new page.
When I get to the new page I would like to update a database, based on what they checked_on on the previous page.
I'm not sure how to do this.
I'm not sure how to pass the information.
I have a page that displays a list of people to email and a checkbox by each name. I want to be able to send to the next page the value of the checkbox and have it either email them if checked or not email if not checked. I know this sounds simple but I have been racking my brain over it for a while now. I have tried naming the checkboxes as so:
<INPUT TYPE="CHECKBOX" CHECKED NAME='chksend<%=objRSOC("PagingGroup")%>' style="font-weight: 700">
And then I am at a loss for what to do on the second page as to how to get the values of the individual checkboxes. If the checkbox is checked the second page would then need to hit the DB for their email address and process the email.
What I have are two pages. One is a form with some input boxes and check boxes on it. It is posting to a different script page that inserts into a database and sends the fields through email.
My problem is sending the information which is checked through to the next page. Each of my checkboxes is given the value of what should be inserted in the table and into the email. I just need a way of determining which checkbox is checked so I can send my information.