Hello again,

I found the solution. Everything was fine, I just had two different Language
objects and I was using the wrong one.

So my understanding of CPM was good at the end...

Thanks anyway,
Oskar




igor.vaynberg wrote:
> 
> On 7/17/07, Toscano <[EMAIL PROTECTED]> wrote:
>>
>>
>> Thank you again.
>>
>> But I'm not very sure of what you are talking about... I declared the
>> DropDowns that way so they are able to change the content for every
>> language
>> with every localization change. But as part of a Form with assigned
>> CompoundPropertyModel, I supposed it should be easy to just map the
>> selected
>> value in the property with the same name.
>>
>> The strange is that I have exactly the same code for a different
>> Dropdown,
>> and I can retrieve the value correctly:
>>
>> Page class:
>>   membershipLevels = new DropDownChoice ("membershipLevel",
>>             new LoadableDetachableModel() {protected Object load()
>> {return
>> getMembershipLevels();}},
>>             new ChoiceRenderer ("membershipLevelName",
>> "membershipLevelID"));
>>
>> Compound Property:
>> private MembershipLevel membershipLevel;
>>
>> Submit:
>>            System.out.println ("MEMBERSHIPLEVEL:" +
>> userInformation.getMembershipLevel().getMembershipLevelID());
>>
>> So yes, you are right, I think I don't understand how it works...
> 
> 
> i guess if you can paste thecode to where you createte the model and its
> object it might be easier.
> 
> there is a good wiki page which goes over how models and compound models
> work you might want to read.
> 
> -igor
> 
> 
> 
> 
> Really... thank you!
>> Oskar
>>
>>
>>
>>
>>
>>
>>
>> igor.vaynberg wrote:
>> >
>> > On 7/17/07, Toscano <[EMAIL PROTECTED]> wrote:
>> >>
>> >>
>> >> Thank you for your fast answer!
>> >>
>> >> It makes sense. I made the following changes:
>> >>
>> >> CompoundPropertyModel:
>> >> private Language defaultSystemLanguage; (with the correct gets/sets)
>> >>
>> >> Submit:
>> >> System.out.println ("LANGUAGE BY DEFAULT:" +
>> >> userInformation.getDefaultSystemLanguage().getLanguageID());
>> >>
>> >> And now the error changes to:
>> >> wicket.util.convert.ConversionException: Can't convert value:
>> >> languageID:14
>> >> - languageName:Japanese to class: class
>> >> iJoinApplication.Entity.Registration.Language for setting it on
>> >> [EMAIL PROTECTED]
>> >>
>> >> UserInformation is the CompoundPropertyModel whose
>> defaultSystemLanguage
>> >> property I changed to Language object.
>> >
>> >
>> > i dont think you understand completely how CPM works
>> >
>> > if you do new CompoundPropertyModel(new Registration());
>> > then that registration has to have the Language defaultSystemLanguage
>> > property. is that the case?
>> >
>> > -igor
>> >
>> >
>> >
>> > Again, thank you so much for all your help.
>> >> Oskar
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> igor.vaynberg wrote:
>> >> >
>> >> > On 7/17/07, Toscano <[EMAIL PROTECTED]> wrote:
>> >> >>
>> >> >>
>> >> >> Hello,
>> >> >>
>> >> >> I have a huge form with a lot of dropdowns, and I'm using a
>> >> >> CompoundPropertyModel. The form can also be changed between more
>> than
>> >> six
>> >> >> languages, so everytime the user changes one value in one Dropdown,
>> >> all
>> >> >> the
>> >> >> form is refreshed showing the DropDowns in the selected language.
>> >> >> The problem is for getting the selected values of the DropDowns
>> when
>> >> >> submit...
>> >> >>
>> >> >> Here is the code:
>> >> >> Declaration of one of the combos in the page class:
>> >> >>
>> >> >>          defaultSystemLanguage = new
>> >> >> DropDownChoice("defaultSystemLanguage",
>> >> >>          new LoadableDetachableModel() {protected Object load()
>> >> {return
>> >> >> getImplementedLanguages();}},
>> >> >>          new ChoiceRenderer ("languageName", "languageID"));
>> >> >>         defaultSystemLanguage.setNullValid(true);
>> >> >>
>> >> >> CompoundPropertyModel:
>> >> >>     private String defaultSystemLanguage; (with gets/sets)
>> >> >>
>> >> >> onSubmit:
>> >> >>     public void onSubmit() {
>> >> >>            System.out.println ("LANGUAGE BY DEFAULT:" +
>> >> >> userInformation.getDefaultSystemLanguage());
>> >> >>
>> >> >> This causes the following error:
>> >> >>
>> >> >> wicket.WicketRuntimeException: No get method defined for class:
>> class
>> >> >> java.lang.String expression: languageID
>> >> >>
>> >> >> What I'm doing wrong? If I specify a CompoundPropertyModel with one
>> >> >> property
>> >> >> with the same name as the DropDown, isn't supposed to be mapped
>> >> directly
>> >> >> there?
>> >> >
>> >> >
>> >> > your model object is of type String as it maps to the String
>> >> > defaultSystemLanguage. your renderer however expects an object it
>> can
>> >> call
>> >> > getLanguageName() and getLanaguageId() on - as you have defined. so
>> >> make
>> >> > defaultSystemLanguage your Language object instead of just a string.
>> >> >
>> >> > -igor
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > Thanks in advance,
>> >> >> Oskar
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Retrieve-selected-value-from-DropDown-tf4100672.html#a11661363
>> >> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> >>
>> -------------------------------------------------------------------------
>> >> >> This SF.net email is sponsored by DB2 Express
>> >> >> Download DB2 Express C - the FREE version of DB2 express and take
>> >> >> control of your XML. No limits. Just data. Click to get it now.
>> >> >> http://sourceforge.net/powerbar/db2/
>> >> >> _______________________________________________
>> >> >> Wicket-user mailing list
>> >> >> Wicket-user@lists.sourceforge.net
>> >> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >>
>> >> >
>> >>
>> -------------------------------------------------------------------------
>> >> > This SF.net email is sponsored by DB2 Express
>> >> > Download DB2 Express C - the FREE version of DB2 express and take
>> >> > control of your XML. No limits. Just data. Click to get it now.
>> >> > http://sourceforge.net/powerbar/db2/
>> >> > _______________________________________________
>> >> > Wicket-user mailing list
>> >> > Wicket-user@lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Retrieve-selected-value-from-DropDown-tf4100672.html#a11661751
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >>
>> -------------------------------------------------------------------------
>> >> This SF.net email is sponsored by DB2 Express
>> >> Download DB2 Express C - the FREE version of DB2 express and take
>> >> control of your XML. No limits. Just data. Click to get it now.
>> >> http://sourceforge.net/powerbar/db2/
>> >> _______________________________________________
>> >> Wicket-user mailing list
>> >> Wicket-user@lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >>
>> >
>> -------------------------------------------------------------------------
>> > This SF.net email is sponsored by DB2 Express
>> > Download DB2 Express C - the FREE version of DB2 express and take
>> > control of your XML. No limits. Just data. Click to get it now.
>> > http://sourceforge.net/powerbar/db2/
>> > _______________________________________________
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Retrieve-selected-value-from-DropDown-tf4100672.html#a11661828
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Retrieve-selected-value-from-DropDown-tf4100672.html#a11663779
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to