473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Dynamic Checkboxes & Event handling

I have some checkboxes that are generated from the results of a database search. At the moment, the checkboxes are part of a table making up a form. Users are going through the form, clicking the boxes and saving to the database at the end with the 'Submit' command button.

Is it possible to save the changes as the checkboxes are clicked? I suppose I'd need to write some dynamic ASP event handling at the same time as creating the checkboxes...

So something like...

<td><input type = "checkbox" name = "chk<%= rstSearch("Product_Group") %>+<%= rstSearch("Depth_Flag") %>" > Select </td>

Function chk87101500
'// Event handler for dynamic checkbox above...
End Function

Scenario:
This is an internal IIS application for selecting stock to send to stores. The page with the checkboxes on is a top level summary, it shows how much is currently stocked / how much available etc. Each check box represents a product line and 'chart ranking', eg;

Feature Films DVD Ranked 1-100 50 Titles Available CheckBoxHere!
Rock & Pop CD Ranked 1-100 47 Titles Available CheckBoxHere!

Users click the checkboxes to select all the products within the line, so by clicking in the above example they would stock 50 or 47 titles. Next to each of these lines is a link to view the products in detail and only select certain ones, in a lot of cases they wouldn't want all 50. In the detail page, they select the titles they want, submit that form, then are redirected back to the summary page which is reloaded and all the totals updated.

Here's the problem! Because the page is being reloaded and changes haven't been committed to the database, I'm losing all of the ticks on the page. The user will work through the summary page ticking certain product lines, then come to a line which they want to view in detail. They go to the detail page, make changes, redirected to summary page & all their work so far has been lost!

I'm not sure on the best way to go about it? Either commit changes on the summary page as they are made or use session variables to keep record of the ticks the user has made? Any other suggestions?!

Thanks
Jul 19 '05 #1
8 2799
CJM
You *can* update you DB when a user checks/unchecks a checkbox, however, you
can't use ASP to do this. ASP is a server-side technology and is blissfully
unaware of what is happening at the client-side.

You need to use a client-side technology, which is almost certainly going to
be Javascript. Bear in mind that 13% of browsers dont have Javascript or
have it disabled, so this wont be a perfect solution for all of your users.

I suggest you re-post your question to microsoft.public.scripting.jscript
NG.

hth

Chris
Jul 19 '05 #2
Yeah sure, I understand that the event handling would be client-side, but surely from the event I could post info to server for ASP routine?

This is an intranet solution, don't have to worry about external users & their browser capabilities...!!

Alternatively, any other ways to keep track of what checkboxes the user has clicked so far, before a DB update has taken place? Session variables were an idea, but there could be lots of product lines & I wouldn't want to use too many?

Thanks

"CJM" wrote:
You *can* update you DB when a user checks/unchecks a checkbox, however, you
can't use ASP to do this. ASP is a server-side technology and is blissfully
unaware of what is happening at the client-side.

You need to use a client-side technology, which is almost certainly going to
be Javascript. Bear in mind that 13% of browsers dont have Javascript or
have it disabled, so this wont be a perfect solution for all of your users.

I suggest you re-post your question to microsoft.public.scripting.jscript
NG.

hth

Chris

Jul 19 '05 #3

"DylanM" <Dy****@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com...
Yeah sure, I understand that the event handling would be client-side, but

surely > from the event I could post info to server for ASP routine?

You would be causing it to "submit" the form with every checkbox "click"
which means it has to make a full round trip to the server and back and the
browser would have to reload the page completely everytime. It would take
forever to go down a list of checkboxes this way.

--

Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com

Jul 19 '05 #4
How can I loop through checkboxes in an ASP? I want to fire a delete
function for each item that is checked off in a form ...
Jul 19 '05 #5
You use client-side script that submits the form using,.. I suppose,..the
OnChange() event of the checkbox.

I don't know anything about XML.

--

Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com
"DylanM" <Dy****@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com...
It's an Intranet application running s'procs over an optimised SQL 2000 BE, gigabit network connection, performance is lightening! I understand that
it's not the best way to deal with data updates (& over an internet
connection would be suicidal!) . An 'all or nothing' transactional update at
the end would be best of course.
Do you have any suggestions for saving the check boxes status, which is my main problem. Session variables? XML?
Thanks

"Phillip Windell" wrote:

"DylanM" <Dy****@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com...
Yeah sure, I understand that the event handling would be client-side,
but surely > from the event I could post info to server for ASP routine?

You would be causing it to "submit" the form with every checkbox "click"
which means it has to make a full round trip to the server and back and the browser would have to reload the page completely everytime. It would take forever to go down a list of checkboxes this way.

--

Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com

Jul 19 '05 #6
The check boxes have a name.
Retreive the values from each check box on the target ASP page that receives
the "submit".
Perform actions based on the values.
In other words they are no different than any other form input object in
that respect.

You don't loop through anything.
--

Phillip Windell [MCP, MVP, CCNA]
www.wandtv.com
<ju********@yahoo.ca> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
How can I loop through checkboxes in an ASP? I want to fire a delete
function for each item that is checked off in a form ...

Jul 19 '05 #7
CJM

"Phillip Windell" <@.> wrote in message
news:ek**************@tk2msftngp13.phx.gbl...
You use client-side script that submits the form using,.. I suppose,..the
OnChange() event of the checkbox.

I don't know anything about XML.


Actually, one solution to consider is using an XMLHTTP object to call
another ASP page to update the DB. It's client-side Javascipt that does the
calling, but ASP that does the DB access:

There are numerous examples listed on Google, but one example I found was
this:
http://jibbering.com/2002/4/httprequest.html

Look half way down - "Calling a server-side Script without refreshing the
page"

Chris

Jul 19 '05 #8
> You'd be better off building a single delete SQL statement for all of
your variables in one go, rather than executing multiple Delete
statements....but you get the idea!

Could you give me an example?

DylanM wrote:
Post your checkboxes to receiving ASP Routine....then something like...
Dim V
Dim vMyItem

For Each V in Request.Form

vMyItem = Request.Form(V)

MyConnection.Execute "DELETE FROM MyTable WHERE MyField = " & vMyItem

Next

You'd be better off building a single delete SQL statement for all of your variables in one go, rather than executing multiple Delete statements....but you get the idea!

"ju********@yahoo.ca" wrote:

How can I loop through checkboxes in an ASP? I want to fire a delete
function for each item that is checked off in a form ...

Jul 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Frank Collins | last post by:
Can anyone point me to some good examples on the web of using values from dynamically created checkboxes on forms in ASP, particularly relating to INSERTING those values into a SQL or Access...
10
by: Steven | last post by:
I create the checkboxes dynamically on my webform (aspx). after I create them, when I check any of the checkboxes, nothing happens. Here is my code ... ArrayList LayerNameList1 = LayerNameList;...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
3
by: Leo J. Hart IV | last post by:
OK, here's another question for the experts: I am building a multi-step (3 steps actually) form using a panel for each step and hiding/displaying the appropriate panel/panels depending on which...
1
by: Abhijit Salvi via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Abhijit Salvi Hi All, I am working on a DataGrid that has a column of Checkbox Controls. There is some Business Functionality...
1
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem:...
1
by: =?Utf-8?B?RG90TmV0RGV2?= | last post by:
Hi, I add some checkboxes to an <ASP.Table> I want execute a function whenever one of the checkboxes is clicked. How can I do that. This is how I was trying... TableRow aRow = new...
0
by: galien8 | last post by:
Dear Newsgroup Readers, I have a problem with dynamic controls, in a DotNetNuke module, and event handlers in VB.NET ASP.NET 2.0. Events are firing and being handled, sometimes good but also...
0
by: =?Utf-8?B?SWRlcm9ja3M=?= | last post by:
Hi All, I created a dynamic checkbox in ASP .Net inside a Button1_Click event method (outside the page_load event) and performed the event handling method for the CheckedChanged event and I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.