Re: Help with WOPopUpButton
Re: Help with WOPopUpButton
- Subject: Re: Help with WOPopUpButton
- From: Oscar Díaz Blanco <email@hidden>
- Date: Wed, 11 Dec 2002 17:52:00 +0100
Hi Reid,
I suppose you have a method called setStateToFind on your results page
to set a variable named stateToFind. Then, why do you make the bindings
NSArray with a variable named selectedState?
If it was a typo, let me know, I will be glad to help you.
Oscar
On miircoles, dici 11, 2002, at 15:46 Europe/Madrid, Reid Bundonis
wrote:
Dear List,
I need help understanding the WOPopUpButton and how to pass the
selection to another component. I want to use it as a search field
(The popup and a submit button are all that is in the form). In my
project example, I have two tables, State and Center. The State table
contains the 50 US States and abbreviations. The Center table
contains information on organizations such as name, address, etc.
Each state can have many centers. The WOPopUpButton displays a list
of the 50 states. It is bound with the following: displayString;
state.stateName, item; state, list; stateDisplayGroup.allObjects,
noSelectionString; "select state", and selection ??? Normally, I
would bind this to center.state if I was to add or edit a record. But
that does not seem to make sense, since I believe I only want to pass
a string value of the selection to a fetch in the next component.
Anyway, here is what I'm doing. On the Main component, I have an
action defined that will call the next page:
public TreatmentResults searchByState() {
TreatmentResults nextPage =
(TreatmentResults)pageWithName("TreatmentResults");
//Tried creating a String (selectedState) and binding it to
selection... nextPage.setStateToFind(selectedState);
nextPage.fetchCenters();
return nextPage;
}
Then on the Results page, I created the fetchCenters method to receive
the value of selectedState, I thought...
public WOComponent fetchCenters() {
NSArray bindings = new NSArray( new Object [] { selectedState
} );
EOQualifier qu =
EOQualifier.qualifierWithQualifierFormat("state.stateName = %@",
bindings );
fs = new EOFetchSpecification("TreatmentCenter", qu, null);
ec = session().defaultEditingContext();
treatmentCenterList = new
NSMutableArray(ec.objectsWithFetchSpecification(fs));
return null;
}
This is not working. So please help. Obviously, I want to return all
centers of a particular state. So what do I bind the WOPopupButton
selection attribute to? And then how do I pass that selected value to
the fetch so that I am searching based on the string value of the
selection? Or am I thinking this though the wrong way?
Thank everyone in advanced for your help.
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.