How do I update each record in a dynamically generated HTML list with a different value?
How do I update each record in a dynamically generated HTML list with a different value?
am 11.07.2005 05:56:21 von marca31
Hello,
I am working on a classroom database for a small nonprofit organization
and have fun into a dilema. I have an HTML form that allows instructors
to select a class from a drop down list and it displays the students
enrolled in the class like this:
if request.form("Classes") <> "" then
session("UClass") = request.Form("Classes")
else
end if
if session("UClass") <> "" then
dim strSQL
set rst = server.CreateObject("adodb.recordset")
rst.activeconnection= MM_pima_string
rst.locktype = 3
rst.cursortype = 3
strSQL = "select * from vwLSTStatus where (intClass = '" &
session("UClass") & "') and (strStatus='Active')"
rst.open strSQL
else
end if
I would like to allow instructors to type a different comment for each
student in the list and submit all of the comments simultaneously. I
have no idea how I would grab the different comments since there is
technically only one object named 'Comments'. I am so stuck. Ideas
anyone? TIA.
Re: How do I update each record in a dynamically generated HTML list with a different value?
am 11.07.2005 16:02:47 von unknown
Hi marca31,
Instead of naming all the comments fields the same, give them a unique name
that you can map back to the corresponding record.
"
/>
Then, in the code that handles the form post, you could do something like:
For Each q in Request.Form
If UCase(Left(q & " ", 8)) = "COMMENTS" Then
intIDInstance = Replace(q,"Comments","")
If IsNumeric(intIDInstance) Then
sSQL = "UPDATE something SET comment = '" &
Safen(Request.Form(q)) & "' WHERE intIDInstance = " & intIDInstance
yourADOObject.Execute sSQL,,129
End If
End If
Next
Function Safen(s)
Safen = Replace(s,"'", "''")
End Function
Ray at work
wrote in message
news:1121054181.823217.95400@z14g2000cwz.googlegroups.com...
> Hello,
>
> I am working on a classroom database for a small nonprofit organization
> and have fun into a dilema. I have an HTML form that allows instructors
> to select a class from a drop down list and it displays the students
> enrolled in the class like this:
>
>
>
> if request.form("Classes") <> "" then
> session("UClass") = request.Form("Classes")
> else
> end if
>
> if session("UClass") <> "" then
> dim strSQL
> set rst = server.CreateObject("adodb.recordset")
> rst.activeconnection= MM_pima_string
> rst.locktype = 3
> rst.cursortype = 3
>
> strSQL = "select * from vwLSTStatus where (intClass = '" &
> session("UClass") & "') and (strStatus='Active')"
> rst.open strSQL
> else
> end if
>
> <%
> if not rst.eof then
> do until rst.eof
> %>
>
> <%
> rst.movenext
> loop
> else
> end if%>
>
> I would like to allow instructors to type a different comment for each
> student in the list and submit all of the comments simultaneously. I
> have no idea how I would grab the different comments since there is
> technically only one object named 'Comments'. I am so stuck. Ideas
> anyone? TIA.
>
Re: How do I update each record in a dynamically generated HTML list with a different value?
am 15.07.2005 08:43:21 von Bullschmidt
Conceptually speaking in somewhat similar situations instead of trying
to edit each row I simply delete the applicable rows in the database and
then add them again...
Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***