13

I hope to express myself with appropriate terms.

I have three entities: customer, country, state. Between country and state, there are two relationships. So I can create a number of countries and select one of these I can create a number of states that belong to it.

For creating the interface of the entity "customer" I put threeNSPopUpButton's:

  • The first selects the country,
  • The second shows the states related to the selected country.
  • The last shows the zip code related to the chosen state.

My problem is that I can not pass data through the chosenNSPopUpButton entity "customer". The NSPopoUpButton works by binding:

  • Content (bind to:country, arrangedObjects),
  • Content Values (bind to:country, arrangedObjects, model key:country),
  • Selected Index (bind to:country, selectionIndex).

What can I do to ensure that the data selected by the three NSPopUpButton's are recorded in the appropriate fields of the entity "customer"?

Guntis Treulands
  • 4,764
  • 2
  • 50
  • 72
Andrea
  • 427
  • 3
  • 16
  • Can you post a bit more code at the View-controller level? To persist changes back to your entity you need to send `save` to the `NSManagedObjectContext` at some point but I suspect you're doing that. – Scott Corscadden Jun 10 '12 at 11:10
  • Do you need to return the managed object, or just return the data in another class that has the data you need? – James Black Aug 26 '12 at 22:27

1 Answers1

1

It would seem that using 3 popups may work with your problem here, as you can return the int for each selected item, and then pass that information on to the next button press.

So, when they press 'country', return back the country id, and put that in your customer entity.

Then, when they press state, pass the country to this popup, and show the states, and pass the state id back, and do the same for city.

This way you don't have lots of managed objects around, as you really don't need the data, you just need the id, and perhaps the name, to show to the user, and these can be passed back in a notification back to your controller.

James Black
  • 41,583
  • 10
  • 86
  • 166