Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8559871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:09:11+00:00 2026-06-11T16:09:11+00:00

I have dynamic checkboxes that are generated as such <cfset counter = 0> <form

  • 0

I have dynamic checkboxes that are generated as such

  <cfset counter = 0>
     <form name="setPermissions" class="setPermissions" action="" method="post">
     <cfoutput>
          <cfloop query="getUserAccess">
              <input name="Meetings_#Counter#" type="checkbox" />
              <cfset counter = counter + 1>
          </cfloop>
      </cfoutput>
      </form>

The getUserAccess query has 6 rows, which means that 6 of these checkboxes will be outputted.

To read these and update the table respectively, I’m running the following query

<cfloop from="0" to="#getUserAccess.RecordCount#" index="i">
   <cfquery datasource="#Request.dsn#">
        UPDATE table SET 
            <cfif structKeyExists(FORM, 'Meetings_#i#')>
            Meetings = <cfif FORM['Meetings_#i#'] EQ "on">1,<cfelse>0,</cfif>
            </cfif>
        WHERE ID = '#an_ID_that_is_specified#'
   </cfquery>
</cfloop>

Apologies if this code isn’t correct, it works when I’m running it on my page, but there are about 20 of these checkboxes being generated, so I’ve snipped my code so you can see only one.

Now, this code works great, when I check a box and submit the form, this code will update the database to set the value to 1.

The only problem is, when I uncheck the box, it won’t change the value to a 0. This is where I am stuck. Why is it not changing the value to 0 when there is no on specified as a form value?

I’ve done a <cfdump> to see if anything was still being passed, but there isn’t.

With all of the boxes ticked I get this dump

MEETINGS_0   on
MEETINGS_1   on
MEETINGS_2   on
MEETINGS_3   on
MEETINGS_4   on
MEETINGS_5   on

With some ticked, the ones which I haven’t ticked are not showing up.

However the value is still not updating from a 1 to a 0.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:09:12+00:00Added an answer on June 11, 2026 at 4:09 pm

    Checkbox simply wont submit any value when unchecked (that’s how it works). So your query should look closer to this:

    UPDATE table SET 
        Meetings = <cfif structKeyExists(FORM, 'Meetings_#i#')>1,<cfelse>0,</cfif>
    WHERE ID = '#an_ID_that_is_specified#'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am new to php... I have been battling on my dynamic checkboxes in such
I have some dynamic buttons that look like this: <input type=button name=button id=button value=Click
I'm developing a search that have a dynamic number of checkboxes and a price
I have a product admin web site that has been generated using ASP.NET Dynamic
Have datgrid with dynamic columns number, like that: <DataGrid DataGridCell.Selected=DataGrid_GotFocus EnableColumnVirtualization=true EnableRowVirtualization=true Name=dataGrid1 DockPanel.Dock=Top
I have dynamic listview on my android client app that receive data from remote
I have some divs that have dynamic heights controlled by a 'click' function as
I have some divs that have dynamic heights controlled by a 'click' function as
I have form where are 2 input fields and then i have dynamic dataTables
I have a dynamic tableview which has a prototype cell with a button that,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.