You could add the foreign key in a beforeSave() routine but, probably
a much simpler way would be to fetch the key you want based on the
date in your register action. Then add a hidden input to the form with
that value.

function register()
{
        if (!empty($this->data))
        {
        
        }
        
        $this->set(
                'the_key',
                $this->Model->OtherModel->getYourKey()
        );
}

echo $form->hidden('the_key', array('value' => $the_key));


On Thu, Apr 23, 2009 at 11:50 AM, [email protected]
<[email protected]> wrote:
>
> It's part of the site logic. Everytime a new user registers, it needs
> to be able to decide what week number (week_id), they are starting in
> based on it being betweek the start and end date in another table.
>
>
> On Apr 23, 3:44 pm, Faza <[email protected]> wrote:
>> want to do it using Cake or just plain good ol' SQL? Also, is it a
>> one-timer, or is it a part of your site logic?
>>
>> [email protected] pisze:
>>
>> > Hi,
>> > I have a question, if I wanted to update a foreignkey field in a
>> > table, based on a date range in another table (eg. it has an id,
>> > startdate, enddate). How would I do that?
>>
>> > Thanks.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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