I have an ASP form that uses a recordset to build a table, with one of the
columns containing a checkbox. Upon posting, the ASP code of the Post-To
page uses the "For i = 1 to request.form("c hkAddToInvoice" ).count" method to
go through the array, but it only counts checked boxes. Not only is this
causing the corresponding Update statement to write values to the wrong
records, it is preventing me from using the "False" value of the check box
to run its corresponding Update statement.
Is there a way to set up the checkbox so that it is counted whether it is
selected or not? 4 8193
No.
With radios, check boxes and buttons, only the values of selected, (or
clicked), elements are submitted.
You could re-run the query in the "post-to" page and loop through the
recordset saying
If (Request.Form(" cbxAddToInvoice _" & objRs.Fields("I D").Value).Coun t Then
' Update to true
Else
' Update to false
End If
Note you would need to change the name of the checkboxes on the original
page to incorporate the ID of the record the checkbox represents. You
probably have this in the checkboxes' value field at the moment. You can
change the value field to anything then.
Regards
David
"WC Justice" <WC*****@bellso uth.net> wrote in message
news:j%******** *******@bignews 1.bellsouth.net ... I have an ASP form that uses a recordset to build a table, with one of the columns containing a checkbox. Upon posting, the ASP code of the Post-To page uses the "For i = 1 to request.form("c hkAddToInvoice" ).count" method
to go through the array, but it only counts checked boxes. Not only is this causing the corresponding Update statement to write values to the wrong records, it is preventing me from using the "False" value of the check box to run its corresponding Update statement.
Is there a way to set up the checkbox so that it is counted whether it is selected or not?
Actually, that could be a bit dangerous if people add to the record set
while the person is checking the boxes.
A better approach would be to GetRows the recordset in to an array and
create a hidden field that contains all the IDs.
<%
Set objRs = objConn.Execute ("STATEMENT" , , adCmdText)
If Not objRs.EOF Then
bHasResults = True
arrResults = objRs.GetRows
iResults = UBound(arrResul ts, 2)
End If %>
<form ...>
<% For i = 0 To iResults %>
<input type=checkbox name="chkInvoic eID_<%=arrResul ts(0, i)%>" value=ON>
<% Next%>
<input type="hidden" name="AllIDs" value="<% For i = 0 To iResults:
Response.Write arrResults(0, i) & ",": Next%>"
</form>
Then in the post to page do
stAllIDs = Request.Form("A llIDs")
If Len(stAllIDs) > 0 Then
arrAllIDs = Split(stAllIDs, ",")
End If
And then proceed as before using arrAllIDs(i) instead of the record set ID
field.
Gotta dash...
"David Morgan" <da***@davidmor gan.me.uk> wrote in message
news:uD******** ******@TK2MSFTN GP09.phx.gbl... No.
With radios, check boxes and buttons, only the values of selected, (or clicked), elements are submitted.
You could re-run the query in the "post-to" page and loop through the recordset saying
If (Request.Form(" cbxAddToInvoice _" & objRs.Fields("I D").Value).Coun t Then ' Update to true Else ' Update to false End If
Note you would need to change the name of the checkboxes on the original page to incorporate the ID of the record the checkbox represents. You probably have this in the checkboxes' value field at the moment. You can change the value field to anything then.
Regards
David
"WC Justice" <WC*****@bellso uth.net> wrote in message news:j%******** *******@bignews 1.bellsouth.net ... I have an ASP form that uses a recordset to build a table, with one of
the columns containing a checkbox. Upon posting, the ASP code of the
Post-To page uses the "For i = 1 to request.form("c hkAddToInvoice" ).count"
method to go through the array, but it only counts checked boxes. Not only is
this causing the corresponding Update statement to write values to the wrong records, it is preventing me from using the "False" value of the check
box to run its corresponding Update statement.
Is there a way to set up the checkbox so that it is counted whether it
is selected or not?
Thanks for the quick reply.
I'm thinking that I could add a hidden box to each row with a value of 0 or
1 and that can be updated with the onChange event in javascript. That way I
will still have the user-friendly checkbox and all records would have a
corresponding value to be counted and used to direct subsequent code. Does
that sound like it might work?
"David Morgan" <da***@davidmor gan.me.uk> wrote in message
news:uD******** ******@TK2MSFTN GP09.phx.gbl... No.
With radios, check boxes and buttons, only the values of selected, (or clicked), elements are submitted.
You could re-run the query in the "post-to" page and loop through the recordset saying
If (Request.Form(" cbxAddToInvoice _" & objRs.Fields("I D").Value).Coun t Then ' Update to true Else ' Update to false End If
Note you would need to change the name of the checkboxes on the original page to incorporate the ID of the record the checkbox represents. You probably have this in the checkboxes' value field at the moment. You can change the value field to anything then.
Regards
David
"WC Justice" <WC*****@bellso uth.net> wrote in message news:j%******** *******@bignews 1.bellsouth.net ... I have an ASP form that uses a recordset to build a table, with one of
the columns containing a checkbox. Upon posting, the ASP code of the
Post-To page uses the "For i = 1 to request.form("c hkAddToInvoice" ).count"
method to go through the array, but it only counts checked boxes. Not only is
this causing the corresponding Update statement to write values to the wrong records, it is preventing me from using the "False" value of the check
box to run its corresponding Update statement.
Is there a way to set up the checkbox so that it is counted whether it
is selected or not?
Sounds good.
"WC Justice" <WC*****@bellso uth.net> wrote in message
news:10******** *****@corp.supe rnews.com... Thanks for the quick reply.
I'm thinking that I could add a hidden box to each row with a value of 0
or 1 and that can be updated with the onChange event in javascript. That way
I will still have the user-friendly checkbox and all records would have a corresponding value to be counted and used to direct subsequent code.
Does that sound like it might work?
"David Morgan" <da***@davidmor gan.me.uk> wrote in message news:uD******** ******@TK2MSFTN GP09.phx.gbl... No.
With radios, check boxes and buttons, only the values of selected, (or clicked), elements are submitted.
You could re-run the query in the "post-to" page and loop through the recordset saying
If (Request.Form(" cbxAddToInvoice _" & objRs.Fields("I D").Value).Coun t
Then ' Update to true Else ' Update to false End If
Note you would need to change the name of the checkboxes on the original page to incorporate the ID of the record the checkbox represents. You probably have this in the checkboxes' value field at the moment. You
can change the value field to anything then.
Regards
David
"WC Justice" <WC*****@bellso uth.net> wrote in message news:j%******** *******@bignews 1.bellsouth.net ... I have an ASP form that uses a recordset to build a table, with one of the columns containing a checkbox. Upon posting, the ASP code of the Post-To page uses the "For i = 1 to request.form("c hkAddToInvoice" ).count" method to go through the array, but it only counts checked boxes. Not only is this causing the corresponding Update statement to write values to the
wrong records, it is preventing me from using the "False" value of the check box to run its corresponding Update statement.
Is there a way to set up the checkbox so that it is counted whether it is selected or not?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve |
last post by:
I'm working on a page for an e-commerce site that has a form than lists items in an order placed by a customer. The form serves two purposes: to edit
and save the details of the items (i.e. number of items, price, etc.) and to split the order (i.e. select certain items to remove from the order and
use to create a new separate order). Each item has a checkbox next to it, and the name for the checkbox is "name" so an array of the checked...
|
by: Paul Morrison |
last post by:
Hi,
I am new to Javascript and am having a bit of difficulty. On my site, in
order for a member to unsubscribe from an article, they go to
the'Unsubscribe' page where they get a table of all of the articles that
they are subscribed to. There is a table with each article, and a checkbox
next to each article. For each checked checkbox it should send the value of
the checkbox to stop_subscription.php.
I have used the following...
|
by: Paul Morrison |
last post by:
Hi,
I have a checkbox array containing the id of a record in a MySQL database.
The checkboxes are created dynamically depending on what is stored in the
database. I want to send the checkbox array to my stop_subscriptions.php
file, running the code on all checked boxes, however I dont seem to be able
to actually send the array, I was hoping that someone could steer me in the
right direction.
Cheers,
|
by: aparth |
last post by:
Hi, I'm having a problem simply putting the values of selected checkboxes into an array using javascript.
The list of checkboxes is dynamically created so I need to count number of checkboxes in order to cycle through them. Also the value of these checkboxes is not 1,2,3,4,5. They are non-sequential id numbers.
function update(chkbox_name)
{
var ids = new Array();
var count = 0;
for(var i=0; i < chkbox_name.length; i++)
{
|
by: JackM |
last post by:
Okay, I'm starting to get a little ticked off because I've worked for
hours on this and I can't seem to find the cause. I'm using PHP 5.1.6.
I'm trying to get the values of some form checkboxes along with another
fixed variable and pass them along in an email. For demonstration
purposes, I have checked the Wed and Fri checkboxes and set the time for
9:00 am.
<FORM ACTION="test.php" METHOD=POST>
<TABLE border="1" width="70%" >
<TR>
| |
by: Nolanclark |
last post by:
Hi there.
I've read a previous thread regarding the Old VB 6 checkbox array and how it's not really needed any more.
That's fine, but I'm not really sure how to implement the checkbox control array in .NET.
I am using an ARCGIS map control which has "Layers" of spatial data (i.e. Roads, Creeks, Rivers, etc.)
When I load the form and the map control, I want to create a Dynamic Table of Contents in the form of Check Boxes in order to control...
|
by: realin |
last post by:
Hiya all,
i am in deep trouble, i thought it was an easy task, but now its getting on my nerves.
Well i have a div on a form, which contains a number of checkboxes, as
<div class="modalData" id="multipleCommSelect" style="padding: 50px;">
<center>Please select the communities from the list below:<br></center>
<label><input name="CommID" value="3" type="checkbox">AIDS</label><br>
|
by: Joni Seth |
last post by:
I have a database of required skills for employees. There is a many to many relationship between the users table and the skills table, called user_skills. It contains the following fields: auto increment ID called user_skillsID, the foreign keys userID from the users table, and skillID from the skills table, a date field called tngdate and a "set" field called achieved. I have a form (called "updateskills.php") that the employees can open which...
|
by: Greg Eyres |
last post by:
Apologies if this is a stupid question ... I'm new to this PHP world!
I have got an html form that has checkboxes dynamically created from MySQL. I use an array to create the list of checkboxes. A user will then check the box as appropriate and I want to store the values. However, only the 1st checkbox value in the array is being retrieved when I hit the submit button.
Would really appreciate an guidance. Thanks
Here is my html code...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |