SQL CODE ----END ACTION---- [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => jgladnick [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> Update myTable Set Sold = 1 Where ID In (#form.SoldItem#) Update myTable Set Sold = 0 Where ID Not In (#form.SoldItem#) Ken [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => The [ip] => info@krcaldwell [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 4 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> Updateable checkbox list - how to tell if checkbox isNOT check on action page - Macromedia ColdFusion

Updateable checkbox list - how to tell if checkbox isNOT check on action page - Macromedia ColdFusion

I need to display the output of a database, and have each row start off with a checkbox. If the user clicks the checkbox, it should have a value of 1, if its unclicked, it should be zero. I have done this kind of before, but only for deleting items. My problem is that my code wont submit any unchecked boxes, so they don't get updated: ----FORM ---- <cfoutput query="GetSponsorshipInfo"> <tr <cfif GetSponsorshipInfo.currentrow mod 2> bgcolor="##E7E4D8"</cfif>> <td><input type="Checkbox" name="SoldItem" value="#ID#"></td> </tr> </cfoutput> ---END FORM---- It should look SOMETHING LIKE THIS, and i can set a variable inside of the loop ...

  1. #1

    Default Updateable checkbox list - how to tell if checkbox isNOT check on action page

    I need to display the output of a database, and have each row start off with a
    checkbox. If the user clicks the checkbox, it should have a value of 1, if its
    unclicked, it should be zero. I have done this kind of before, but only for
    deleting items.

    My problem is that my code wont submit any unchecked boxes, so they don't get
    updated:


    ----FORM ----

    <cfoutput query="GetSponsorshipInfo">
    <tr <cfif GetSponsorshipInfo.currentrow mod 2> bgcolor="##E7E4D8"</cfif>>
    <td><input type="Checkbox" name="SoldItem" value="#ID#"></td>
    </tr>
    </cfoutput>


    ---END FORM----


    It should look SOMETHING LIKE THIS, and i can set a variable inside of the
    loop to determine if its a 1 or zero after i figure out the first problem.

    ----BEGIN ACTION----
    <!--- first we check to see if any items were marked for deletion --->
    <cfif IsDefined("form.deleteitem")>

    <cfloop list="#form.deleteitem#" index="i">
    <cfquery name="deleteItem" datasource="#DSNStats#">
    SQL CODE
    </cfquery>
    </cfloop>

    </cfif>


    ----END ACTION----

    jgladnick Guest

  2. #2

    Default Re: Updateable checkbox list - how to tell if checkboxis NOT check on action page

    It depends on what you are trying to do in the action page. What do you mean by "updated". If an item was checked you want to delete it... and if it was not checked, what do you want to do with it?


    mxstu Guest

  3. #3

    Default Re: Updateable checkbox list - how to tell if checkboxis NOT check on action page

    Sorry,

    If something is checked, the column "Sold" for that record should be set to .
    If that row is NOT checked, OR unchecked, then the column "Sold" for that row
    should be set to 0

    So really we are updating every row in the database. Don't worry about
    overhead, the table will never be larger then 40 rows.

    jgladnick Guest

  4. #4

    Default Re: Updateable checkbox list - how to tell if checkboxis NOT check on action page

    All you need to do is 2 queries in the action page

    After the form is submitted, you will have a list of ID's for the "checked"
    checkboxes

    So

    <!-- this will update all the checked items --->
    Update myTable
    Set Sold = 1
    Where ID In (#form.SoldItem#)

    <!--- this will update all the unchecked items --->
    Update myTable
    Set Sold = 0
    Where ID Not In (#form.SoldItem#)

    Ken

    The Guest

  5. #5

    Default Re: Updateable checkbox list - how to tell if checkboxis NOT check on action page

    Add in some validation :-) and Ken's query should work fine, assuming your
    form always displays ALL of the records in the table being updated. If your
    form only displays a subset of the records in that table then you will probably
    need to do a little extra manipulation to get a list of items in the subset
    that were "sold" and "un-sold".

    mxstu Guest

  6. #6

    Default Re: Updateable checkbox list - how to tell if checkboxis NOT check on action page

    Originally posted by: jgladnick
    So really we are updating every row in the database.

    Sorry, I missed this line. Since you DO want to update the entire table, the
    issue of "subsets" doesn't apply here.



    mxstu Guest

Similar Threads

  1. Check/deselect the checkbox dynamically
    By personaex in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: November 30th, 01:29 AM
  2. Replies: 4
    Last Post: June 13th, 02:29 AM
  3. Check the Checkbox
    By Lenny@ford in forum Dreamweaver AppDev
    Replies: 0
    Last Post: May 12th, 02:31 PM
  4. ASP.Net checkbox list
    By Jignasha in forum ASP.NET General
    Replies: 0
    Last Post: June 30th, 11:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •