Re: [Newbie] Direct action woes
Re: [Newbie] Direct action woes
- Subject: Re: [Newbie] Direct action woes
- From: Amorya North <email@hidden>
- Date: Fri, 16 Jul 2004 11:38:38 +0100
Damnit, I feel stupid...
What I'm doing appears to be impossible, because I wanted something
added on to the form submit URL depending on the menu item selected.
And of course, the form URL is already written to the HTML by the time
the user gets a selectable menu, so there's nothing it can do to add
the URL!
Sorry to waste your time
Amorya
(now off to rethink how my app will work!)
On 16 Jul 2004, at 1:33 am, Amorya North wrote:
Am trying to have a play with the Direct Action stuff...
Firstly, all these sites giving helpful code neglected to tell me to
put the action in the Direct Action class file! It took me hours to
figure that one out :)
Anyway, I've got an action. Doesn't do much 'cos I'm just testing it.
It's called listFicsAction(). All it does so far is send the user to
listFiction.wo.
BUT - I want something to be passed in the URL.
On Main, I have a form which is nicely populated with a list of Genres
from my database. There's a popup menu with the Genres, and a submit
button.
I added a binding of ?genreID to the submit button. Then I made a
method called genreID() with the following code:
public Integer genreID() throws java.lang.NullPointerException {
try {
NSDictionary primaryKey =
EOUtilities.primaryKeyForObject(selectedGenre.editingContext(),
selectedGenre);
return (Integer) primaryKey.valueForKey("genreID");
} catch (java.lang.NullPointerException exception) {
Integer a = new Integer(0);
return a;
}
}
(Yes, the catching exception thing took me ages to figure out too!) I
then bound that method to the binding ?genreID that I'd just created in
the submit button.
Well, I compile at that point, and clicking the submit button goes back
to main. It turns out I have to have the direct action method bound in
the WOForm's DirectAction binding too, not just in the submit button.
(That confused me 'cos when doing normal actions, you don't have to
touch the form.)
Anyhow, I now have it going to the new page, but it doesn't put the
genre ID in the URL! I was told that if I had a binding starting with a
question mark, it automatically got shoved in the URL.
Before anyone says anything, I know I don't have any code to get it out
of the URL at the other end. I've not got to that yet. I want my form
to put it in there!
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.