• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

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

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
Janrow
Asked:
Janrow
  • 2
1 Solution
 
JanrowAuthor Commented:
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
 
azadisaryevCommented:
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
 
JanrowAuthor Commented:
Exactly right! Thanks for the clarification.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now