Jon,
Thanks for your detailed help.
One thing I might not have made clear is that my view/filtering form
has only one check box and the check box is not connected to each
record.  And I have other fields in the form that let me filter the
records that I am looking for.  Once the user has filtered the records
he wants to modify, then he finally checks the 'Mark records shown'
check box and then clicks the submit button to mark only the records
that are showing with todays date in a date field for each record
shown. Although Ajax would be nice to have, it is not necessary if I
can just get the data to show properly after the change with a
refresh...So I think I need an array of shown records that gets built
as the records are filtered and then use that array to update the
records from the controller...So I guess the question now is how do I
build the data array manually from the view file...

view/process_member.thtml
for ()
{
   if ($chkMark=='1')
   {
      // Mark selected months
      if($chkMonth1=='on')
         //*** If the next line would write to the database it would
work but it doesn't write to the database
         $subscription['Subscription']['month1_mailinginfo_sent']=date
('Y-m-d');
         // So I guess I need to build an array here and then use that
in the controller to update the datbase
         //****THIS IS WHERE I NEED TO POST BUT NOT SURE HOW TO DO
THAT??
***
   }

On Jan 14, 10:45 pm, "Jon Bennett" <[email protected]> wrote:
> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to