|
 |
asp_databases thread: checkbox
Message #1 by sridarti@s... on Sun, 9 Dec 2001 04:40:14
|
|
Hi, i have a query,
i have a page with records retrieve from DB. beside each record i have a
checkbox, how do i check to see which record is selected? and also the
value of a particualr field so that when i click the button it will bring
me to another page and display the details of that record?
theoraticlly i understand but practically i do not,
can someone help?
thanks
Message #2 by "Ken Schaefer" <ken@a...> on Sun, 9 Dec 2001 16:09:03 +1100
|
|
Request.Form("chkBoxNameHere")
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <sridarti@s...>
Subject: [asp_databases] checkbox
: i have a page with records retrieve from DB. beside each record i have a
: checkbox, how do i check to see which record is selected? and also the
: value of a particualr field so that when i click the button it will bring
: me to another page and display the details of that record?
:
: theoraticlly i understand but practically i do not,
:
: can someone help?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Sridarti Herryanto" <sridarti@s...> on Sun, 9 Dec 2001 15:35:29 +0800
|
|
Hi Ken,
Request.Form("chkBoxNameHere")
is to be input into the page where want to display the record details am
i right to say that? but how do i know if the button from teh prev page has
been click...the reason for this check box and another field value(A or B)
is such that i can dynamically populate the database table accordingly to
the selected records based on the field value if it is A or B....
thank you.
sri
----- Original Message -----
From: "Ken Schaefer" <ken@a...>
To: "ASP Databases" <asp_databases@p...>
Sent: Sunday, December 09, 2001 1:09 PM
Subject: [asp_databases] Re: checkbox
> Request.Form("chkBoxNameHere")
>
> Cheers
> Ken
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: <sridarti@s...>
> Subject: [asp_databases] checkbox
>
>
> : i have a page with records retrieve from DB. beside each record i have a
> : checkbox, how do i check to see which record is selected? and also the
> : value of a particualr field so that when i click the button it will
bring
> : me to another page and display the details of that record?
> :
> : theoraticlly i understand but practically i do not,
> :
> : can someone help?
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
$subst('Email.Unsub').
Message #4 by "Ken Schaefer" <ken@a...> on Sun, 9 Dec 2001 18:54:58 +1100
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Sridarti Herryanto" <sridarti@s...>
Subject: [asp_databases] Re: checkbox
: Hi Ken,
:
: Request.Form("chkBoxNameHere")
:
: is to be input into the page where want to display the record details
am
: i right to say that? but how do i know if the button from teh prev page
has
: been click...the reason for this check box and another field value(A or B)
: is such that i can dynamically populate the database table accordingly to
: the selected records based on the field value if it is A or B....
:
: thank you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You create the HTML form elements with a name like so:
<input type="checkbox" name="ID" value="<%=objRS("ID")%>">
You check to see if the checkbox was checked by looking (in the next page)
in the Request.Form collection:
If Request.Form("ID").Count > 0 then
' At least 1 checkbox was checked
' So contruct an SQL statement to get the associated records out of the
' database
strSQL = _
"SELECT field1, field2, field " & _
"FROM table1 " & _
"WHERE tableID IN (" & Request.Form("ID") & ")"
Set objRS = objConn.Execute strSQL
Else
' No checkboxes were checked
End If
%>
Cheers
Ken
Message #5 by "Sridarti Herryanto" <sridarti@s...> on Sun, 9 Dec 2001 16:01:13 +0800
|
|
thank you for the reply i shall go try it.....
sincerely,
sri
----- Original Message -----
From: "Ken Schaefer" <ken@a...>
To: "ASP Databases" <asp_databases@p...>
Sent: Sunday, December 09, 2001 3:54 PM
Subject: [asp_databases] Re: checkbox
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "Sridarti Herryanto" <sridarti@s...>
> Subject: [asp_databases] Re: checkbox
>
>
> : Hi Ken,
> :
> : Request.Form("chkBoxNameHere")
> :
> : is to be input into the page where want to display the record details
> am
> : i right to say that? but how do i know if the button from teh prev page
> has
> : been click...the reason for this check box and another field value(A or
B)
> : is such that i can dynamically populate the database table accordingly
to
> : the selected records based on the field value if it is A or B....
> :
> : thank you.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> You create the HTML form elements with a name like so:
>
> <input type="checkbox" name="ID" value="<%=objRS("ID")%>">
>
> You check to see if the checkbox was checked by looking (in the next page)
> in the Request.Form collection:
>
> If Request.Form("ID").Count > 0 then
>
> ' At least 1 checkbox was checked
> ' So contruct an SQL statement to get the associated records out of
the
> ' database
>
> strSQL = _
> "SELECT field1, field2, field " & _
> "FROM table1 " & _
> "WHERE tableID IN (" & Request.Form("ID") & ")"
>
> Set objRS = objConn.Execute strSQL
>
> Else
>
> ' No checkboxes were checked
>
> End If
> %>
>
> Cheers
> Ken
>
>
>
$subst('Email.Unsub').
Message #6 by nimesh vijayan <vnimesh@y...> on Sun, 9 Dec 2001 17:59:55 -0800 (PST)
|
|
Hi,
Assign the same name for all checkboxes in a
page and its value will be different, fo example,
value may be recordid. In the next page, u just
iterate the checkbox and it will give u the selected
values.
page1.asp
<input type=checkbox name="chkbox"
value="<%=rs("id")%>">
<input type=checkbox name="chkbox"
value="<%=rs("id")%>">
<input type=checkbox name="chkbox"
value="<%=rs("id")%>">
page2.asp
-------
for each chkitem in request("chkbox")
response.write chkitem
next
---------------
Hope this will work..
Rgds,
Bala
--- sridarti@s... wrote:
> Hi, i have a query,
>
> i have a page with records retrieve from DB. beside
> each record i have a
> checkbox, how do i check to see which record is
> selected? and also the
> value of a particualr field so that when i click the
> button it will bring
> me to another page and display the details of that
> record?
>
> theoraticlly i understand but practically i do not,
>
> can someone help?
>
> thanks
$subst('Email.Unsub').
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
|
|
 |