Clarify WOPopUpButton
Clarify WOPopUpButton
- Subject: Clarify WOPopUpButton
- From: Reid Bundonis <email@hidden>
- Date: Wed, 11 Dec 2002 14:58:03 -0500
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.