Re: Problem with Direct Action
Re: Problem with Direct Action
- Subject: Re: Problem with Direct Action
- From: Gilles MATHURIN <email@hidden>
- Date: Fri, 5 Jan 2007 08:43:25 -0400
Thanks for the quick response, but i have already noticed that and i
couldn't find anywhere with a key named "albumid" instead of
"albumId" even in my EOModel file, so i am stuck there … and it's
very frsutrating.
Regards.
GM
Le 5 janv. 07 à 08:34, Ute Hoffmann a écrit :
It does not complain about the variable not set but it does not
find the variable with the given key. Maybe there is a spelling
error somewhere? It looks for albumid, with a small i although you
have set your key as albumId.
Error: valueForKey(): lookup of unknown key: 'albumid'.
In my opinion that is the problem and you have to look further into
why he looks for the wrong function.
Hope that helps,
Regards,
Ute
Am Freitag, 05.01.07 um 13:02 Uhr schrieb Gilles MATHURIN:
Hello all,
I get a weird bug when using a direct action bound to a dynamic
hyperlink.
First let me say where i come from in the app navigation :
Page A displays infos on a Personn like his name, biography and a
table of his albums in a WOTable with a WORepetition in it.
When u click on one of these albums name, u should go to an
AlbumPage which displays more information on it.
To do so, i made a WOHyperlink around the creationItem.name, here
is the wod config for this hyperlink :
====================
Hyperlink1: WOHyperlink {
directActionName = "voirAlbumPage";
actionClass = "DirectAction";
?albumchoisi = albumItem.pkValue;
}
====================
where albumItem.pkValue return the primary key of the creationItem
and pass it to the DA.
Here is the DA method
====================
// DA qui renvoie à AlbumPage
public WOActionResults voirAlbumPageAction() {
AlbumPage nextPage = (AlbumPage)pageWithName("AlbumPage");
String pk = (String)this.request().formValueForKey("albumchoisi");
nextPage.setAlbumChoisiID(pk);
return nextPage;
}
====================
And here is the appendToResponse Method in the destination page
who should fetch the right EO based on the pk transmitted and then
display the informations on it with its relationships infos by KVC .
===================
public void appendToResponse(WOResponse response,WOContext context) {
EOEditingContext ec = new EOEditingContext();
NSMutableDictionary pkDict = new NSMutableDictionary();
pkDict.setObjectForKey(new Integer(Integer.parseInt
(albumChoisiID)), "albumId");
try {
ec.lock();
this.setAlbumChoisi((Album)EOUtilities.objectWithPrimaryKey
(ec,"Album",pkDict));
} finally {
ec.unlock();
}
/*this.selectionAvis(albumChoisi());
this.setAUrl(dynamicURL());*/
super.appendToResponse(response,context);
}
====================
Must mention that i use the same pattern for the Page A which
display the Person infos.
But here is the stack trace i get when cliking on the link to go
to the DetailCreationPage :
====================
Error:
com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException:
valueForKey(): lookup of unknown key: 'albumid'. This class does
not have an instance variable of the name albumid or _albumid, nor
a method of the name albumid, _albumid, getAlbumid, or _getAlbumid
Reason:
<Album 0x46b158> valueForKey(): lookup of unknown key: 'albumid'.
This class does not have an instance variable of the name albumid
or _albumid, nor a method of the name albumid, _albumid,
getAlbumid, or _getAlbumid
i have put several NSLog.out to control the variable at different
level and they all have the primary key integer of the clicked
album name… so i don't get it.
If someone can make me see the ligth, i will appreciate a lot.
Thanks.
GM _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40tt-pixelmind.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