• 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
WO Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

WO Question


  • Subject: WO Question
  • From: Dana Kashubeck <email@hidden>
  • Date: Thu, 28 Jun 2007 11:52:55 -0400
  • Organization: Riemer Reporting Service, Inc.

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
-------------------------------------

begin:vcard
fn:Dana Kashubeck
n:Kashubeck;Dana
org:Riemer Reporting Service, Inc.;MIS
adr:Suite 100;;24600 Detroit Road;Westlake;Ohio;44135;United States of America
email;internet:email@hidden
title:Systems Manager
tel;work:440-835-2477 ext. 125
tel;fax:440-835-4594
x-mozilla-html:FALSE
url:http://www.riemer.com
version:2.1
end:vcard

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

 _______________________________________________
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

  • Prev by Date: Re: Problem with a form
  • Next by Date: Parent Hyperlink to submit Child Form [was WOQuestion]
  • Previous by thread: Re: Problem with a form
  • Next by thread: Parent Hyperlink to submit Child Form [was WOQuestion]
  • Index(es):
    • Date
    • Thread