Re: WO Question
Re: WO Question
- Subject: Re: WO Question
- From: "Jerry W. Walker" <email@hidden>
- Date: Sun, 1 Jul 2007 09:11:47 -0400
On Jun 28, 2007, at 11:52 AM, Dana Kashubeck wrote:
Hi, Dana,
I'm about 270 messages behind on my mailing lists right now, so I
haven't had time to think this through very well, but it seems to me
that if you inverted your logic by making your current parent
component a child component of the accounts as a PageWrapper
component, then your primary interaction would be with the account
component rather than the navigation component. This would also
generalize the navigation component to wrapping any kind of page
rather than just those that exactly fit the bindings of your current
account components.
There may be flaws in my logic (e.g. what page is shown when the user
first displays the accounts), but it seems like it would simplify
your interaction with the page.
Regards,
Jerry
Okay, I'm a bit stuck. This is rather long and I hope I'm
explaining myself clearly . . .
THE SITUATION: I have a parent component which handles navigation
between a list of accounts for data entry. There is one link per
account. Each link is a WOHyperlink and calls selectAccount in the
parent component, which sets an ivar and returns the page. The
child component contains the form for data entry and gets the
appropriate account from a binding to the parent. The child
component is responsible for all data validation and relaying any
errors to the user. The mechanics are kind of complicated, but
basically the child component puts any errors into hidden fields on
the form, then the Javascript parses the values of those fields and
displays the errors on the page appropriately.
This all works great when you haven't made any changes to the data
or when there are validation errors from the Javascript. However,
it has become difficult to get the form submitted (thus calling the
child component's action method saveExp) when the Javascript
validation succeeds.
DESIRED RESULTS: The user makes changes to the data in the form,
then clicks on an account link to enter data for another account.
The Javascript detects the changes and asks the user if they want
to save them. The user chooses to save the new data, Javascript
validation succeeds, and the form gets submitted, calling saveExp
on the child component. The child component validates the data.
If validation succeeds, a page with a data entry form for the
selected account is returned. If the validation does not succeed,
then the same page is returned, this time with the validation
errors for the user to fix.
"DIRTY" SOLUTION: The only thing I've been able to come up with so
far is to put Javascript in the onclick of the WOHyperlink in the
parent to set the value of a hidden field on the form with the
accountID of the account it represents, then perform the steps
outlined above (check for changes, etc.). If the user wants to
save their changes and Javascript validation succeeds, then the
onclick handler would submit the form and return false. This means
that saveExp is called on the child component and the parent
component doesn't get the selectAccount call.
If the child component succeeds in validating and saving the data,
then it would have to set the selectedAccount value in the parent
and use performParentAction to return the appropriate page. If
validation fails, it would just return [[self context] page] as it
does now.
WHY I DON'T LIKE THIS SOLUTION: Maybe I'm being a bit picky, but I
don't like it because it requires the parent to know something
about the form. I was hoping to completely isolate the form
operations within the child because eventually there will be
several different versions of the child component and the parent
will have a WOSwitchComponent to display the correct one. Yes, I
can make sure that each one has the appropriate field for the
accountID, so it is certainly doable. I was just hoping to avoid
the parent having anything to do with the form and simply worrying
about navigation.
QUESTION: Is there a better or more elegant way to update the
value of selectedAccount in the parent and still submit the form in
the child?
--
-------------------------------------
Dana Kashubeck
Systems Manager
Riemer Reporting Service Inc.
http://www.riemer.com
Phone: 440-835-2477 x. 125
Fax: 440-835-4594
-------------------------------------
<dana.kashubeck.vcf>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
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