• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Adding/Removing objects to/from toMany relationships.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding/Removing objects to/from toMany relationships.


  • Subject: Re: Adding/Removing objects to/from toMany relationships.
  • From: Alexander Spohr <email@hidden>
  • Date: Tue, 8 May 2007 09:24:08 +0200

David,

if you want to do all that within a single POST you could do the following:
- Modifying attributes as usual (textfields and the like).
- Deleting or adding components can be done with temporary NSArrays, collection the ones to add/delete while takeValues does its job (checkbox setCheckedMethod -> put into array) and execute them in your invoked action.
- Moving might be a bit more complicated as you have to track to which now objects it should be connected in the action.
The trick is to first collect and then execute all at once in the action. The next appendToResponse will reflect the changes.


If you want to do it right away for each single object I see no problem at all: do it in your action.

	atze


Am 07.05.2007 um 22:35 schrieb David Avendasora:

The issue I'm having relates to the Golden Rule of Request Response loops:

"Don't modify anything that the component or dynamic elements depend on while in the sequence appToResponse, takeValuesFromRequest and invokeAction."

Okay, this is a well documented problem, but only from the perspective of what you must not do, but I can't find any documentation on how to do things the Right Way and I can't seem to figure it out for myself.

Here's my class structure: Routing<-->>RoutingStep<-->>Component

What I want to be able to do is allow the user to add/remove RoutingSteps and Components, move a Component from one RoutingStep to another, as well as change the values of the attributes of all three entities all using one page that returns to itself upon the form being submitted. Yes, it's a lot to do one one page, but by using CSS and JS, I've been able to make it quite straight-forward from the user's perspecive.

How do I properly make this type of update without confusing WO and getting "schizophrenic" results?

I've read

The Wiki: http://en.wikibooks.org/wiki/Programming:WebObjects/ Web_Applications/Development/ General_Best_Practices#Avoid_Changing_WOComponent_Structure_Before_It_ Is_Used

Jerry Walker's sermons on it: http://lists.apple.com/archives/ webobjects-dev/2005/Jul/msg00509.html

Chapters 6 and 7 of Practical WebObjects

I'm assuming that because I'm returning to the same page, I need to do my work in appendToResponse, but I just don't get how to do that. Can anyone shed some light on this for me?

Thanks,

Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40freeport.de


This email sent to email@hidden

Freeport & Soliversum Alexander Spohr email@hidden www.freeport.de


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Adding/Removing objects to/from toMany relationships. (From: David Avendasora <email@hidden>)

  • Prev by Date: Re: Apple's Support of WebObjects
  • Next by Date: Re: Apple's Support of WebObjects
  • Previous by thread: Re: Adding/Removing objects to/from toMany relationships.
  • Next by thread: Unable to map destination
  • Index(es):
    • Date
    • Thread