[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Multiple checkboxes when checked only pass one variable in my list.

Posted on 2009-02-19
3
Medium Priority
?
319 Views
Last Modified: 2013-12-24
The INPUT checkbox only outputs one item even when multiple checkboxes are selected. Catalog_id is a number variable and for testing there are five catalog_id's available. Only the first catalog_id will be passed in the del_list output. Checking the other checkboxes has no effect; they are not passed by the form.

The cfoutput query is working. I inserted the #OrderInfo.catalog_id# so I can see the different catalog_id's next to the checkbox.

Look at my code and show me where I'm going wrong, why del_list output never shows more than one item.
<cfdump var="#form#">
<cfparam name="cid" default="852604">
 
<cfif IsDefined("Remove")>
  <cfif NOT IsDefined("del_list")>
    <H1>No items checked to remove.</H1>
  </cfif>
  <cfif IsDefined("del_list")>
    <cfloop list="#del_list#" index="i">
      <cfquery name="dUpdate" datasource="cart">
       delete from orders
       where catalog_id = '#i#'       
       and cid = '#cid#'
     </cfquery>
    </cfloop>
  </cfif>
</cfif>
 
 
<cfquery name="OrderInfo" datasource="cart">
  select catalog_id,cid
  from orders   
  where cid = '#cid#'
  order by id desc
</cfquery>
 
<form name="form1" action="gunk.cfm" method="post">
<input type="submit" name="remove" value="Remove">
<br>
<cfoutput query="OrderInfo">
#OrderInfo.catalog_id#  <input type="checkbox" name="del_list" value="#catalog_id#">
  <br>
  <input type="hidden" name="cid" value="#cid#" />
  </form>
</cfoutput> 

Open in new window

0
Comment
Question by:Janrow
  • 2
3 Comments
 

Accepted Solution

by:
Janrow earned 0 total points
ID: 23687927
Ah solved this myself. Got to placd the submit button below the cfoutput and end the form there.
</cfoutput>
<input type="submit" name="remove" value="Remove">
</form>

Open in new window

0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 23688069
just fyi, where you place the submit button does not matter (as long as it is inside the <form> body) - you can move it back to the top of form if you want to.
you problem was that you had the closing </form> tag inside the <cfoutput> = you form effectively ended after your first checkbox.

Azadi
0
 

Author Comment

by:Janrow
ID: 23688325
Exactly right! Thanks for the clarification.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question