• 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: Custom PopUp Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom PopUp Problems


  • Subject: Re: Custom PopUp Problems
  • From: Scott Winn <email@hidden>
  • Date: Wed, 26 Apr 2006 13:58:54 -0700

First off, welcome to WebObjects!\

Thanks! Like I told Chuck. I feel like I am learning WebObjects from the inside out.


Hi WOList,

I am relatively new to WebObjects (and Java for that matter).

I am trying to create a reusable component that is essentially a WOPopUpButton with a custom fetch that generates the list attribute. That part is working. When I put this component in a page, it will be used to edit a relationship attribute of the Object the page is displaying. I am not using WOToOneRelationship because of the custom fetch logic.

I guess my first question is, why are you coupling a UI element with your model? I would really like to hear more about the custom fetch logic, and why it makes sense to have the rolled up into a component.

Apparently Project Wonder has an ERXToOneRelationship with EODataSource and Qualifier bindings, so it can't be that unusual. Unfortunately, now is not a good time to see if I can get Wonder working. For my part, I am pulling a subset of objects that have a relationship to a particular user. User X sees objects 1, 2, and 3 in the pop-up : User Y sees objects 4, 5, and 6. 1, 2, 3, and 4, 5, 6 are all the same type of thing (so they are in the same table). There is just different visibility depending on who the User is.



WOPopUpButton handles all off the necessary selection logic if you let it. The typical way to bind a pop-up list would be to bind the 'list' attribute to either an NSArray in your component, or a method that fetches the correct set of objects. You would bind 'item' to an instance variable that corresponds to a single item in your array, and 'selection' to the relationship. As an example, if you have a page that allows you to set the teacher relationship of a student where the teachers are fetched with custom logic, you could have java that looks like this:

public Teacher teacher;
public Student student;
private NSArray teachers;

public NSArray teachers() {
	if (teachers == null) {
		teachers = <ANY CUSTOM LOGIC YOU WANT>;
	}
	return teachers;
}

Assuming the Student EO has a to-one relationship called 'teacher', your bindings would be:

list = teachers
item = teacher
selection = student.teacher
displayString = teacher.fullName

When entering the page, the pop up would automatically be set to the correct teacher for the student. When submitting the form it should be on, whatever teacher was selected would now be connected to the student's teacher relationship.

The problem I am having is that I want to make the Pop-Up a reusable component. I don't want to have to include all of the Fetch and Qualifier logic in every page component that needs this pop-up. So I made the new WOComponent. It is a partial page. I included the fetch logic, and the list, item, displayString, noSelectionString, and selectedValue bindings necessary for the WOPopUpButton. Then I inserted the Pop-Up component into a page that does the editing.


At this point, I can run the app and the pop-up will appear on the editing page with the correct list contents.

My problem is

1) I don't know how to tell the custom pop-up component what the current object value to edit is (so it can get the selected="selected" HTML in the option tag)

2) I don't know how to get the user selected value out of my custom component to the page component that is doing the editing.

This is only a problem because I'm trying to build a reusable component. If I were using a regular WOPopUpButton I would just bind my objects parameters to the correct pop-up bindings. But since it is a custom component when I include it on my editing page it doesn't have any bindings at all.

I hope that clarifies things a bit, if not, I'll try again (or start messing with Project Wonder).


Thanks,

Scott




I have two problems. . .

1) I have the Object on an EditObject page, and I want to tell the Custom Pop-up Component to "select" the current value that is part of that Object (see option 3 below).

<select>
  <option value="1">A Value</option>
  <option value="2">A Value</option>
  <option value="3" selected="selected">My Object's Value</option>
  <option value="4">A Value</option>
</select>

I have no idea how to get WO to put selected="selected" on correct list option.

2) Since it is a custom object and has no default bindings, I don't how or what to hook it to on my EditObject page so that the Object will get the user selected value when I save it.

I have preformed due diligence trying to find my own answer, but all the info I could find either didn't seem to apply, or I just didn't understand it. Any and all help is appreciated.

Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com


This email sent to email@hidden



_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Custom PopUp Problems
      • From: wojingo <email@hidden>
    • Re: Custom PopUp Problems
      • From: Ken Anderson <email@hidden>
    • Re: Custom PopUp Problems
      • From: "Jerry W. Walker" <email@hidden>
References: 
 >Custom PopUp Problems (From: Scott Winn <email@hidden>)
 >Re: Custom PopUp Problems (From: Ken Anderson <email@hidden>)

  • Prev by Date: Re: Webobjects-dev Digest, Vol 3, Issue 264
  • Next by Date: Re: Custom PopUp Problems
  • Previous by thread: Re: Custom PopUp Problems
  • Next by thread: Re: Custom PopUp Problems
  • Index(es):
    • Date
    • Thread