Tuesday, September 28, 2010

Re: updating a value when user clicks a link

Hi

Well its during the creation of an advert that the relevant field in appointments would need to be updated so it seemed like the best place to do it

thanks

On Mon, Sep 27, 2010 at 7:19 PM, cricket <zijn.digital@gmail.com> wrote:
On Mon, Sep 27, 2010 at 10:24 AM, james livsey
<jameslivsey@googlemail.com> wrote:
> Thanks Cricket,
>
> I added that code as you suggested. While it doesnt cause any errors it
> doesnt seem to modify the field data either.
>
> what I have is:
>
>    function add($appointment_id = null){
>        //existing code
>        $this->Advert->Appointment->id = $appointment_id;
>        $this->Advert->Appointment->saveField('appointment_status', 'Order');
>        $this->Advert->create();
>    }
>
>
> does that look about right?
>
> And yeah your right i should change it to status
>
You've got create() in the wrong place. That should come first, if
it's included at all. See the API:

http://api.cakephp.org/class/model#method-Modelcreate

$this->Advert->Appointment->create(array('Appointment' => array('id'
=> $appointment_id)));

That will initialize the instance with the appropriate id.

Actually, why are you calling create() on Advert, instead of
Appointment? I'm guessing there's more to this method.

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: