Re: Clarify WOPopUpButton
Re: Clarify WOPopUpButton
- Subject: Re: Clarify WOPopUpButton
- From: "Thomas Peters" <email@hidden>
- Date: Wed, 11 Dec 2002 20:25:57 -0500
I have an Entity Object named Customer and another named State with a
relationship in EOModler 'one State to many Customers'. I generated the Java
code for both entities. Now I want to create a WOComponent for searching and
updating Customer. The customer search form should have a WOPopUpButton
containing a list of States from which to search which may or may not be the
only search criteria on the form. eg. I could have a form that searches
cistomers by State, Customer_id, customerName, etc.
I also need to create an edit form with a WOPopUpButton for editing the
State code for a customer. What is the best way to build this functionality?
Should I create a form with the wizard for Customer and then manually add
the State DisplayGroup to the Component. I think it's the bindings I need
help with.
Thank you.
Tom
----- Original Message -----
From: "Reid Bundonis" <email@hidden>
To: <email@hidden>
Sent: Wednesday, December 11, 2002 2:58 PM
Subject: Clarify WOPopUpButton
> Oscar, thanks for the fast reply. Let me try to clean up what I had
> before. I mixed two attempts to make this work and screwed up the code
> samples in the last post. I went back in and here is what I got and
> what I am getting.
>
> TreatmentCenterAdd:
> The WOPopUp is bound with displayString; state.stateName, item; state,
> list; stateDisplayGroup.allObjects, and selection to selectedState
> The submit button is bound to searchByState as the action.
>
> In the TreatmentCenterAdd.java file, I've got:
> protected String selectedState;
>
> public TreatmentResults searchByState() {
> TreatmentResults nextPage =
> (TreatmentResults)pageWithName("TreatmentResults");
> nextPage.takeValueForKey(selectedState,"searchByState");
> return nextPage;
> }
>
> Then in the TreatmentResults component I've got this:
>
> public WOComponent setSearchByState(String selectedState) {
> String searchValue = selectedState;
> NSArray args = new NSArray(new Object[] { searchValue } );
> String formatString = "state.stateName like %@";
> qual = EOQualifier.qualifierWithQualifierFormat( formatString, args );
> fs = new EOFetchSpecification("TreatmentCenter", qual, null);
> ec = session().defaultEditingContext();
> treatmentCenterList = new
> NSMutableArray(ec.objectsWithFetchSpecification(fs));
> return null;
> }
>
> When I select a state name from the WOPopUpButton on Main and press go,
> I throw an error and get:
>
> While trying to set the field "selectedState" on an object of type
> TreatmentAdd we expected a java.lang.String but received a State with a
> value of {values = {stateAbbrev = "AZ"; stateName = " Arizona";
> treatmentcenters = "<com.webobjects.eocontrol._EOCheapCopyMutableArray
> 486684 (<EOAccessArrayFaultHandler treatmentcenters
> _EOIntegralKeyGlobalID[State (java.lang.Integer)3]>)>"; }; this =
> "<State 471d1f _EOIntegralKeyGlobalID[State (java.lang.Integer)3]>"; }.
> This often happens if you forget to use a formatter.
>
> This is the what I would do when passing a value from a WOTextField on
> to the next page. Anyway, I appreciate the help. What am I doing
> wrong?
>
> Reid
> _______________________________________________
> 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.
_______________________________________________
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.