Hi xybersoftware,

>  My form does not have any editable fields...
>  I only want to change certain fields of the records that are shown in
>  the view if a user checks a check box and clicks submit...
>  If the user checks the box then I want to mark all the records that
>  are shown with todays date...
>  I guess the question now is how do I post the data from the view so
>  that in the controller so I can update the database...

if you want to do this _without_ a page refresh, you'll have to do so
via an AJAX request. This requires all the same logic and controller
code as a normal save from a form, there's no shortcut!

The functions you need are:

controller method which accepts POST data ($this->data)
model method which saves POST data
prototype/jquery/mootools javascript code to submit the form when a
checkbox is changed

in psyudeo code you want to:

* a html page which lists all your items inside a single form
* each item in the html page has a checkbox, which has a unique ID and
name. The ID of the checkbox should correspond to the record, eg the
ID (primary key) of the record
* the form submits to a controller method, say /my_controller/update_all_records
* this controller method calls a (custom) model method, Model->updateAll($data)
* Model->updateAll() loops over the data, and all records that have a
checked checkbox are updated
* back to your view, you have some javascript which is listening to
the 'onchange' event for all your checkboxes
* when a checkbox is changed, some more javascript creates a http post
request to another controller method, update_record
* the controller method calls a corresponding model method,
Model->updateRecord($data);
* your model method validates the data, and if it's ok and the
checkbox is checked, it updates the date field

That's about the size of it - good luck!

Hope this helps

Jon
ps: if you don't need a degradable non-javascript version, you can
skip all the 'update all records' stuff above

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to