thanks for all the responses, sorry for being slow, but I don't understand:
> * grab the 'lastInsertId()' of the event record > * pass this to the view to use in your User form, eg User.event_id where do I grab the lastInsertId()? in the event_controller? and then how do I pass it to the user view? I know there's other ways to do it, but right now I just want to get what I have working. Thanks. On Jan 18, 4:16 am, "Jon Bennett" <[email protected]> wrote: > > You can't have an Event.user_id if there's no User. You're doing this > > backwards. > > yep, so the order of things (doing it event first would be) > > * show new event form > * on submit, save data to create a new Event record > * grab the 'lastInsertId()' of the event record > * pass this to the view to use in your User form, eg User.event_id > * on submit, grab the event id out of the data array, then save the > user data to create a new form > * if all ok, grab the 'lastInsertId()' of the user record > * update the 'user_id' field of the Event you created previously with > the User id you just created > > It's really quite long winded though, I would go for 1 form > personally, not 2. If you have a lot of fields, you could use some JS > to show/hide the 2 sections. If you don't want to go the JS route, > create the User first. This would have the added benefit of working > for Users who've already registered as well, as you just need to check > for a logged in user and grab that ID rather than show the 'new user' > form. > > hth > > jon > > -- > > 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 -~----------~----~----~----~------~----~------~--~---
