Re: an IllegalArgumentException
Re: an IllegalArgumentException
- Subject: Re: an IllegalArgumentException
- From: Geoff Hopson <email@hidden>
- Date: Fri, 19 Dec 2003 10:15:30 +0000
Declare a NSMutableArray in your component, bind that to the
'selections' binding in your WOBrowser declaration. If you need a
pre-selecetd categroy, add that category to the NSMutableArray.
When you save your form, take the selections NSMutableArray, pull the
seleceted category from it (objectAtIndex 0) and then assign it to your
tbEcmProduct.
Reason: Your tbEcmProduct is expecting an instance of class Category,
not of class NSMutableArray (which is what the selections binding in
WOBrowser is passing)
HTH,
Geoff
On 19 Dec 2003, at 09:36, Jonathan Fleming wrote:
Hi Guys
Right, tb stands for table, Ecm stands for e-commerce and then the
it's the class name, just so that you know...
I have a Product class and a Category class (prefix omitted here for
briefity), Product has a toOne relationship with Category and toMany
on the reverse (Cat<...>>>Prod).
In a form I've created i'm using a WOBrowser element to show my list
of categories from which I'm allowed to select one categoryName, the
binding are as follows:
Browser_category: WOBrowser {
displayString = tbEcmCategory.categoryName;
item = tbEcmCategory;
list = tbEcmCategoryDisplayGroup.allObjects;
size = 6;
selections = tbEcmProduct.tbEcmCategory;
multiple = false;
}
Now my relationships works beautifully if i'm adding a new Category
without the WOBrowser by typing the name in, however, I want to simply
select a categorName, so what I want to know is what is the best way
to format this so that i don't keep ending up with this error message:
Error: java.lang.IllegalArgumentException: While trying to invoke the
set method "public void TbEcmProduct.setTbEcmCategory(TbEcmCategory)"
on an object of type TbEcmProduct we received an argument of type
com.webobjects.foundation.NSMutableArray. This often happens if you
forget to use a formatter.
Reason: While trying to invoke the set method "public void
TbEcmProduct.setTbEcmCategory(TbEcmCategory)" on an object of type
TbEcmProduct we received an argument of type
com.webobjects.foundation.NSMutableArray. This often happens if you
forget to use a formatter.
I'm not too sure on how to get the String Object at the given index
from the NSArray of the WODisplayGroup's allObjects method.
Any pointers...
Kind regards
Jonathan :^)
_________________________________________________________________
Sign-up for a FREE BT Broadband connection today!
http://www.msn.co.uk/specials/btbroadband
_______________________________________________
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.
--
Geoff Hopson
Objectology Ltd.
http://www.objectology.co.uk/
_______________________________________________
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.