Re: Primary keys, direct actions, and the WO "way"
Re: Primary keys, direct actions, and the WO "way"
- Subject: Re: Primary keys, direct actions, and the WO "way"
- From: "Clive Roberts" <email@hidden>
- Date: Tue, 13 Jul 2004 16:15:51 +0100
you can pass the primary key via the request for the next direct action.
1 First you will use a WOHyperlink or WOSubmitButton to invoke the direct
action.
2 Select the link or button and add a binding, give the binding a name
e.g ?genreID (the question mark indicates this will be passed in the URL).
3 Bind the value to pass (your primary key) to this new attribute
(?genreID). to do this create a method (accessor key) genreID that will
return the primary key e.g.
public Integer genreID() {
NSDictionary primaryKey =
EOUtilities.primaryKeyForObject(genre.editingContext(), genre);
return (Integer) primaryKey.valueForKey("genreID");
}
I recommend yu take a look at Ravi Mendis' book if you are going to want
more stuff on DirectActions.
hope it helps
Clive Roberts
----- Original Message -----
From: "Amorya North" <email@hidden>
To: <email@hidden>
Sent: Tuesday, July 13, 2004 3:29 PM
Subject: Primary keys, direct actions, and the WO "way"
> [Newbie alert!]
>
> OK, I'm designing a site that'll have people's short stories on. The
> stories are sorted into genres, so you'll be able to get a listing of
> all the scifi stories, or all the fantasy stories, etc.
>
> I'd like the lists of stories to be bookmarkable, so I understand you
> need a direct action for that. As I understand direct actions, it means
> you can't use the usual helpful WO stuff like passing objects between
> pages. Everything has to go through the URL. Right?
>
> Now, when developing in PHP, I would have just shoved the primary key
> to the genre in question in the URL. Like
> mypage.com/viewstories.php?genre=7.
>
> But in everything I've read about WO, it says "don't touch the primary
> key"!
>
> So how would I identify the genre in question in a direct action?
>
> (Forgive me for not being entirely sure how direct actions work. If
> It's entirely possible I've missed something major.)
>
>
> Amorya
> _______________________________________________
> 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.