Monday, September 27, 2010

Re: editing rows from index.cttp

Hi Jeremy thankyou for replying.

yes there are multiple rows and the idea is that it would be more user friendly if the user could 'batch update' multiple records in one view.

so in my index i have the normal columns of data eg

    <td><?php echo $advert['Advert']['ad_size']; ?>&nbsp;</td>

but at the end there is the addition of:

    <td>
    $this->Form->create('Advert');
    echo $form->input('contract_received');
    </td>

with the form end after the foreach (so there isnt a submit for every row):

   <?php echo $this->Form->end(__('Submit', true));?>

On the controller i tried using saveAll as following

   $this->Advert->set($this->data);
   $this->Advert->saveAll($this->data);

but i think im missing the way to 'fire' the event.

Does that sound like the right way of doing it? At the moment the submit button doesnt do anything.

Thanks - hope that isnt too confusing

On Fri, Sep 17, 2010 at 2:47 PM, Jeremy Burns | Class Outfit <jeremyburns@classoutfit.com> wrote:
Do you mean that there are multiple rows, each of which could have been updated? If so, (assuming that your form encompasses all of the potential updates) check your $this->data array when the form is submitted. Depending upon its structure you can either do a saveAll($this->data) or loop through and do a series of saves.

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 17 Sep 2010, at 14:38, james wrote:

> Hi I have a field that shows if a contract has been received or not in
> my index view. This field needs to be editable from within the same
> view with one submit button committing the changes to the table. Is
> this possible? Im not entirely sure as to the correct way to go about
> this?
>
> Thanks in advance
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: