|
 |
asp_web_howto thread: Re: text box identity
Message #1 by kyle.b.willman@u... on Thu, 20 Jun 2002 10:30:55 -0500
|
|
You beat me to it, Paul.
I was drafting the same concept, just a different twist to take into
account the Response.Write:
RowCount = 0
While NOT RsTable.EOF
Insert first two columns...
With Response
.Write("<TD>")
.Write("<input type=""text"" name=""DateFrom" & CStr(RowCount)
& """>")
.Write("</TD>")
.Write("<TD>")
.Write("<input type=""text"" name=""DateTo" & CStr(RowCount) &
""">")
.Write("</TD>")
.Write("<TD>")
.Write("<input type=""checkbox"" name=""chk" & CStr(RowCount) &
""">")
.Write("</TD>")
End With
RowCount = RowCount + 1
wend
Now, loop through the values and perform the action based upon those check
boxes set to "on" like
LoopCount = 0
While LoopCount < RowCount
If Request.Form("chk" & CStr(LoopCount)) = "on" then
Do something with
Request.Form("DateFrom" & CStr(LoopCount))
Request.Form("DateTo" & CStr(LoopCount))
End if
LoopCount = LoopCount + 1
wend
Hope this helps clarify a little more.
Kyle B. Willman
PricewaterhouseCoopers LLP
Office: xxx.xxx.xxxx
Cell: xxx.xxx.xxxx
Paul R Stearns
<pauls@c... To: "ASP Web HowTo" <asp_web_howto@p...>
m> cc:
06/20/2002 10:08 Subject: [asp_web_howto] Re: text box identity
AM
Please respond to
"ASP Web HowTo"
Vic:
This is easily accomplished by generating a unique Identifier as you
generate your
screen such as;
<%
RowCount = 0
While NOT RsTable.OF
%>.
.
.
<input type="text" name="InDate<% =CStr(RowCount) %>" value="<%
=RsTable("INDATE") %>">
<%
RowCount = RowCount + 1
wend
%>
Wherever you do your insert/update you need to loop through each
request.form("InDate" & CStr(RowCount)) and process it accordingly.
Paul
vic wrote:
> I made a loop that creates a row in a table. In each row there are five
> columns. In column one is the name of a report which is displayed from a
> database. Column two has the catagory - again displayed from a database.
> Columns three and four have text boxes named datefrom and dateto
> respectively in which the user can input dates and column five has a
> checkbox - the value of which is the reportname. I do not need to write
> anything back to the database. I need to display the reportname and the
> dates on another page.
> My problem is that the textboxes all share the same names and so as well
> as listing lots of commas for the empty textboxes, I cannot tell which
> dates belong to which row. My database also contains a report_id. Is it
> possible to somehow insert the id into the textbox values per row or is
> there any way to give each table row a unique name or is there any way at
> all round this?
>
> please please help.........
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_________________________________________________________________
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance
upon, this information by persons or entities other than the
intended recipient is prohibited. If you received this in error,
please contact the sender and delete the material from any
computer.
Message #2 by Paul R Stearns <pauls@c...> on Thu, 20 Jun 2002 11:08:20 -0400
|
|
Vic:
This is easily accomplished by generating a unique Identifier as you generate your
screen such as;
<%
RowCount = 0
While NOT RsTable.EOF
%>.
.
.
<input type="text" name="InDate<% =CStr(RowCount) %>" value="<%
=RsTable("INDATE") %>">
<%
RowCount = RowCount + 1
wend
%>
Wherever you do your insert/update you need to loop through each
request.form("InDate" & CStr(RowCount)) and process it accordingly.
Paul
vic wrote:
> I made a loop that creates a row in a table. In each row there are five
> columns. In column one is the name of a report which is displayed from a
> database. Column two has the catagory - again displayed from a database.
> Columns three and four have text boxes named datefrom and dateto
> respectively in which the user can input dates and column five has a
> checkbox - the value of which is the reportname. I do not need to write
> anything back to the database. I need to display the reportname and the
> dates on another page.
> My problem is that the textboxes all share the same names and so as well
> as listing lots of commas for the empty textboxes, I cannot tell which
> dates belong to which row. My database also contains a report_id. Is it
> possible to somehow insert the id into the textbox values per row or is
> there any way to give each table row a unique name or is there any way at
> all round this?
>
> please please help.........
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
Message #3 by "vic" <vweston@m...> on Thu, 20 Jun 2002 11:44:37
|
|
I made a loop that creates a row in a table. In each row there are five
columns. In column one is the name of a report which is displayed from a
database. Column two has the catagory - again displayed from a database.
Columns three and four have text boxes named datefrom and dateto
respectively in which the user can input dates and column five has a
checkbox - the value of which is the reportname. I do not need to write
anything back to the database. I need to display the reportname and the
dates on another page.
My problem is that the textboxes all share the same names and so as well
as listing lots of commas for the empty textboxes, I cannot tell which
dates belong to which row. My database also contains a report_id. Is it
possible to somehow insert the id into the textbox values per row or is
there any way to give each table row a unique name or is there any way at
all round this?
please please help.........
Message #4 by "vic" <vweston@m...> on Fri, 28 Jun 2002 11:03:27
|
|
is there any way that I can put the loop (or the results of the loop) into
an email using aspmail?
Message #5 by "vic" <vweston@m...> on Mon, 24 Jun 2002 16:11:29
|
|
Now, loop through the values and perform the action based upon those check
boxes set to "on" like
LoopCount = 0
While LoopCount < RowCount
If Request.Form("chk" & CStr(LoopCount)) = "on" then
Do something with
Request.Form("DateFrom" & CStr(LoopCount))
Request.Form("DateTo" & CStr(LoopCount))
End if
LoopCount = LoopCount + 1
wend
Sorry to ask the obvious, but I don't seem to be able to adapt this piece
of the code. After I have done the rowcount section, I then send the form
to itself. I would like to check that any of the checkboxes are "on" and
if so to write out the reportname, datefrom and dateto. I think I'm
missing something in my code, but if anyone can make sense of it, I'd be
most impressed:
chosen = request.servervariables("content_length")
if chosen <> 0 and len("chk" & rowcount) <> 0 then
loopcount = 0
while loopcount < rowcount
if request.form("chk" & loopcount) = "on" then
response.write request.form("reportname" & rowcount)
response.write " "
response.write request.form("datefrom" & rowcount)
response.write " "
response.write request.form("dateto" & rowcount)
end if
loopcount = loopcount + 1
wend
response.end
Message #6 by "vic" <vweston@m...> on Tue, 25 Jun 2002 13:40:04
|
|
Message #7 by "Ken Schaefer" <ken@a...> on Tue, 25 Jun 2002 15:36:40 +1000
|
|
<%
Do While Not objRS.EOF
Response.Write( _
"<input type=""textbox"" name=""Report_" & objRS("ReportID") &
""">")
Response.Write( _
"<input type=""hidden"" name=""ReportID"" value=""" &
objRS("ReportID") & "">")
objRS.MoveNext
Next
%>
will create textboxes with the ReportID built into the name, similar to:
<input type="textbox" name="Report_1">
<input type="textbox" name="Report_2">
<input type="textbox" name="Report_3">
<input type="textbox" name="Report_4">
Note also that I created a hidden input element who's *value* (not name)
contains the corresponding reportID?
Now, in the next page, we can loop through all the ReportIDs, and look at
the corresponding textbox:
<%
If Request.Form("ReportID").Count > 0 then
For Each x in Request.Form("ReportID")
Response.Write(x & " = " & Request.Form("Report_" & x) & "<br>")
Next
End If
%>
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "vic" <vweston@m...>
Subject: [asp_web_howto] text box identity
: I made a loop that creates a row in a table. In each row there are five
: columns. In column one is the name of a report which is displayed from a
: database. Column two has the catagory - again displayed from a database.
: Columns three and four have text boxes named datefrom and dateto
: respectively in which the user can input dates and column five has a
: checkbox - the value of which is the reportname. I do not need to write
: anything back to the database. I need to display the reportname and the
: dates on another page.
: My problem is that the textboxes all share the same names and so as well
: as listing lots of commas for the empty textboxes, I cannot tell which
: dates belong to which row. My database also contains a report_id. Is it
: possible to somehow insert the id into the textbox values per row or is
: there any way to give each table row a unique name or is there any way at
: all round this?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
 |