Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Form Checkbox (Multiple Checkbox with Same Name) 2

Status
Not open for further replies.

rleffew1

Vendor
Oct 20, 2003
8
US
This is hard for me to explain.

If you look at my page I have created I can use this as a reference point.


I have created a form with a table inside.

The table is populated by a Access database. According to User input from a previous page I don't know how many rows of data. This will depend on how many students are in a class.

The table has three elements I care about.

1) studentID (Hidden Field)
2) chkAttend (checkbox named chkAttend)
3) chkPLUCredit (checkbox name chkPLUCredit)

The user can check one or both or none of the checkboxes per student.
So this will vary. This means I will have multiple studentID's, multiple chkattends and multiple chkPlucredits. I need to then read the final form and update my master file with the checkboxes that have been checked. I cant figure out how to do this. I understand this can be done in javascript. Any source I can go to read on how to do this?

Thanks,

Bob Leffew
 

Are you wanting to code your ASP in JavaScript, or do you mean client-side JavaScript?

If the latter, I would advise against this.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
I am not familiar with JS. I do ASP.VbScript.

I just know I cannot do what I want to in ASP.

Do you understand the problem I have? If so any suggestions on how to solve. I am hoping using JS can help. I am open to any approach. Problem is I cant read a form as is.

Thanks,

Bob LeffewHome
 
You can't update a database with client-side scripting. You'll need to submit the form and use ASP to take care of that.

Lee
 
Why do you say you cannot do what you want with ASP? It IS possible to do it in ASP. Search the MSDN for "querystring" and look at the "index" property that allows you to reference one of multiple values with the same name. The same applies to Request.Form.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
This what I am having a hard time figuring out is the how to read thru the form once I have submitted it. If a checkbox is not check nothing shows up.

Example? studendID being a hidden field.

studentid checkbox1 has a check checkbox2 has a check
studentid checkbox1 no check checkbox2 check
studentid checkbox1 check checkbox2 no check
studentid checkbox1 no check checkbox2 check

The student ID is a hidden field that stores the studentID. This is the index that will allow me to read the students file. How do I know which Checkbox1 belongs to which student. Doesnt the form output the results into what is basically a text file? If so the results would look like the following

235 249 240 289, Yes, Yes, Yes Yes

Obviously I am confused.

Bob Leffew
 
tsdragon,

I have been searching for a way to take care of my problem. I also do ASP and VB. I know how to program. I have never had to use a form in this manner. I am trying to keep the user from having to go to each users master record to make the change. Its easier for the user to have the students listed on the same page with check boxes next to them.

Do you have a specific link you can send me to? I cant find it in MSDN.

Thanks for you help.

Bob Leffew
 
Here's two ways to do it with the QueryString from the MSDN. Similar methods apply to Form.
---------------------------------------------------------
You can use an iterator to loop through all the data values in a query string. For example, if the following request is sent

[tt][/tt]

and Names.asp contained the following script,

[tt]---NAMES.ASP---
<%
For Each item In Request.QueryString("Q")
Response.Write item & "<BR>"
Next
%>[/tt]

Names.asp would display the following.

Fred
Sally

The preceding script could also have been written using Count.

[tt]<%
For I = 1 To Request.QueryString("Q").Count
Response.Write Request.QueryString("Q")(I) & "<BR>"
Next
%>[/tt]

----------------------------------------------------------

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top