1 Reply Latest reply on Jun 2, 2008 9:46 AM by Magikaru

    ColdFusion, AJAX and Form Checkboxes

    davidknighton
      Greetings all...

      I am new to AJAX, particularly as it pertains to CF. I've searched pretty extensively but I can't seem to find a solution or example of how to integrate AJAX with CF in a way that I can automatically pass an update to a table when a checkbox is clicked.

      I understand from my searching that this functionality is made simple in CF8, however I am developing this in CF MX7, and upgrading is not a possibility right now. I hope someone has some knowledge, or even an example of this somewhere on the Interwebs that I can pick apart to learn from.

      Basically, the details of what I want to do is: I output a list of items from a DB table into a list. The last column on this list contains a checkbox. When I click the checkbox next to an item, I want to update that record in the associated DB table...in this case I would be updating a row from 0 to 1 or back to zero again if the box is unchecked. I am also limiting the number of boxes checked to 5, but I've already figured out that logic using Javascript and it is working.

      I suspect this is a very simple thing to do, however my unfamiliarity with AJAX is causing a huge problem. Thanks in advance for any help you can give or resources you can point me to. It is much appreciated.


      David K.
        • 1. ColdFusion, AJAX and Form Checkboxes
          Magikaru
          This might not be the best way to get it done, but what I would do is have an invisible iFrame in the page. When the checkbox is clicked, use javascript to submit a form on the iFrame which will do the updating work.

          If you opt for this solution, be aware that a possible problem could be when the user clicks the checkboxes faster than the iFrame can do the updating work. This will cause the iFrame to start a new update operation without finishing the first.