Re: Simple Web forms to create an EO object
Re: Simple Web forms to create an EO object
- Subject: Re: Simple Web forms to create an EO object
- From: Nathan Dumar <email@hidden>
- Date: Wed, 4 Aug 2004 11:03:36 -0400
No worries with method 1, as long as you're not using the
defaultEditingContext.
If you're creating the record when the page opens, then create a new ec
(myEC, for example) just before creating the new record, and insert the
record into myEC. The record will not be permanently added until you
explicitly do myEC.saveChanges(). If the user doesn't save, but
instead goes to a different page or site, WO will throw away myEC and
all of its contents (the inserted, blank record) when it throws away
the cache of the page (automatically done).
No blank records!
(If you add the record to the defaultEditingContext, then any other
page that executes defaultEditingContext.saveChanges() will save the
blank record, since it is in the same editing context.)
Take care,
Nathan
On Aug 4, 2004, at 10:43 AM, Amorya North wrote:
OK, multiple choice. Which is best for a simple form (eg a user
registration form) where one EO object needs to be created.
1. Create and insert the EOObject when the page is loaded. The form is
bound directly to this new EO object. Submit button just saves
changes.
2. Page is bound to lots of temporary variables. Submit button creates
EOObject, populates it, and saves changes.
3. Other.
I'm currently trying to do method 1, since it avoids a zillion
temporary variables... but I'm unsure whether it might be less secure
and more likely to end up with a blank record inserted or whatever. My
PHP roots would suggest method 2, as that's _all_ you can do in PHP,
but it strikes me that WO might have a better way.
Amorya
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.