Re: Updating Nested To-Many Relationship *NOT SOLVED*
Re: Updating Nested To-Many Relationship *NOT SOLVED*
- Subject: Re: Updating Nested To-Many Relationship *NOT SOLVED*
- From: Chuck Hill <email@hidden>
- Date: Wed, 11 Apr 2007 12:57:34 -0700
On Apr 11, 2007, at 12:50 PM, David Avendasora wrote:
On Apr 11, 2007, at 2:03 PM, Chuck Hill wrote:
On Apr 11, 2007, at 12:01 PM, Ken Anderson wrote:
This is one of Jerry's reponses:
http://lists.apple.com/archives/webobjects-dev/2005/Jul/
msg00509.html
I am trying to wrap my mind around what Jerry has written here.
It's going to take me a while, I think.
Yeah, it takes a while.
What Chuck is suggesting happening is that you have something on
your page (like a WOConditional) that's state is bound to
something that is changing.
Or you are altering the contents of an array that is bound to a
WORepetion. That would be my guess based on your description of
this page. Adding, removing, or moving the elements of an array
while WO is in a repetition will have very, very odd effects from
scrambled data to exceptions.
Chuck
I am altering two arrays that are bound to WORepetitions by moving
an object from one to the other, but how is this different than if
I had simply deleted/added an object from/to a relationship? Those
functions alter the contents of arrays bound to WORepetitions as
well and yet seem to work just fine.
There are two possibilities:
1. You were just lucky
2. You were altering the array _after_ the repetition had finished
processing it
Think of a repetition as a for loop. WO runs through the loop once
during appendToResponse when it first sends the page back to the
browser. It runs it a second time while is it in
takeValuesFromRequest moving the form values into objects. It runs
though the loop a third time during the invokeAction phase. If you
alter what is in the arrays during this sequence, WO will mistake one
object for another. Think of the .HTML and .WOD as a programming
language that WO interprets and _executes_ during each phase of the
RR loop. That is pretty close to what actually happens. It is NOT
static, it really does "execute" and WO calls methods in your Java
class _while_ it is executing.
Chuck
When the form post comes back, WO tries to match up the structure
of the page to get all the values out, and it effectively 'gets
lost'. What I usually do is have hyperlink or submit actions
modify temporary variables that are not referenced during page
creation. Then, I override appendToResponse() in the component
and update the real data from the temporary variables. This way,
you guarantee that your page structure is the same.
Ken
On Apr 11, 2007, at 2:47 PM, David Avendasora wrote:
Okay, I'm having a hard time finding the info by googling for
it. Any chance of a link?
Thanks,
Dave
On Apr 11, 2007, at 11:16 AM, Ken Anderson wrote:
You can look for my prior postings too... I've even written up
a decent solution a couple of times... :)
On Apr 11, 2007, at 12:07 PM, Chuck Hill wrote:
Paging Mr. Walker, Mr. Jerry Walker. Mr. Jerry Walker, please
come to the WO List. :-)
This is one of Jerry's most favored rants. I am pretty sure
that what is happening is that you are modifying the structure
of the page while it is processing the takeValues phase.
Search for some of Jerry's past postings on this for the cause
and solution.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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