Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 20th, 2004, 03:52 AM
Authorized User
 
Join Date: Nov 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to get value from check box.....

I am writing a page where i wanted to update one or more records. I'm using check box to determine which record to be update.

but i dont know how to get the check box value and validate all the record under the particular selected field .

e.g. i need to edit record A and B, so i also need to validate all other records under record A and B is not empty.

How can i do this??:(

hope u all can understand.

advanced thanks.



 
Old April 22nd, 2004, 05:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Name all the checkboxes with same name with each having the value as the ID/Key field value in your table. When you submit that page, all the values of all check boxes (whichever is checked) are passed under the same name with values separated by COMMA. So you can loop through those values or use them as it is in you update statement depending on the nature of the Update statement.

Eg:
Assume the following records.
KeyVal Name
1 Vijay
2 Cici
3 Planoie
4 Pgtips

If you have Checkboxes named as "chkUpdate" and Value of each checkbox for each record as 1, 2, 3, 4

Then If you have checked only the checkboxes of Vijay and Cici, then on submission to the other page, when retrieved as

Response.write Request.Form("chkUpdate")

will hold value as "1,2"

Then you can split them into an array using SPLIT function.

ArrUpdate = Split(Request(Form("chkUpdate"))

You can use this in Update statement looping through the array values

Start LOOP Based on i
 "Update MyTable Set Name=" & Request.Form("Name") & "Where KeyVal=" & Arr(i)
End LOOP

Note : I have just given you the Pseudocode above there. Syntactically you should make changes as needed.

Hope that helps.

Cheers!

-Vijay G
 
Old May 15th, 2004, 08:35 AM
Authorized User
 
Join Date: Nov 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks! I will try it.






Similar Threads
Thread Thread Starter Forum Replies Last Post
check box help? dstein4d Access VBA 2 February 27th, 2008 09:54 AM
Check BOx kaushikpulpa ASP.NET 2.0 Professional 2 August 30th, 2007 08:01 AM
VBA - Check box KennethMungwira Access VBA 2 May 22nd, 2006 10:43 AM
please help (get check box value) qadeerahmad General .NET 3 September 24th, 2004 08:46 AM
Check box Error surendran BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 July 25th, 2004 11:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.