• 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
Re: Pop Up Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pop Up Question


  • Subject: Re: Pop Up Question
  • From: Jonathan Rochkind <email@hidden>
  • Date: Wed, 31 Mar 2004 12:50:19 -0600

I can see why you might think the 'value' binding could be used like this, but it really can't. The 'value' binding isn't too useful, except in very special circumstances (often involving javascript).

[It's also worth noting that you are working with a weird de-normalized db schema here; it might make a lot more sense to normalize the schema instead of using strings like that.]

Instead, I'd bind 'selection' to a getter and setter method that operate based on the what you want W. Bind the popup "selection" to the key "categorySelection", for instance, and then provide methods. Hmm, I'm trying to figure out based on your description what those methods should do. Here's what I come up with, if I understand what you're doing properly.

public void setCategorySelection(AdvertiserCategory selectedCategory) {
theNewAdvertiserItem.setCategory( selectedCategory.industryCategory() );
}


public AdvertiserCategory categorySelection() {
//Hmm, having trouble figuring out how to do this with your de-normalized schema.
//You need to somehow return the AdvertiserCategory object with an "industryCategory"
//field that matches the "category" field of theNewAdvertiserItem. But there's no good/easy
//way to do that. There are certainly ways to do it, left as an excercize to the reader.


//Or, you can just return 'null', which means the popuplist will never have an initially
//selected value, it will always display with no values selected, until the user selects one.


	return null;
}


--Jonathan

At 10:23 AM -0800 3/31/04, Hunter Hillegas wrote:
I have a question about the use of pop up buttons.

I have a two entities. One is 'Advertiser' and the other is 'AdvertiserCategory'. Advertiser has a 'String' field called category and AdvertiserCategory has a 'String' field called 'industryCategory'.

Categories are displayed in a drop down on the form and when an advertiser is created I want the 'industryCategory' field of the selected category item to be assigned to the 'category' string field of the Advertiser.

I have the following wod for the pop up right now:

CategoryPopUp: WOPopUpButton {
	class = "gen";
	item = theAdvertiserCategoryItem;
	list = theAdvertiserCategoryList;
	selection = theNewAdvertiserItem.category;
	value = theAdvertiserCategoryItem.industryCategory;
}

The problem is that it appears that when I submit, WO tries to assign the value of 'item' not 'value' to the field specified in 'selection'... This obviously causes a type mismatch.

What I am wondering is if I can do this with different bindings or if I need to do it programatically by probing the request and setting the value myself.

Thanks,
Hunter
_______________________________________________
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.


References: 
 >Pop Up Question (From: Hunter Hillegas <email@hidden>)

  • Prev by Date: Re: Pop Up Question
  • Next by Date: Re: Pop Up Question
  • Previous by thread: Re: Pop Up Question
  • Next by thread: Project-based Java templates in WO5.2.3
  • Index(es):
    • Date
    • Thread