Now almost there.  I'm understanding the use of models much better now.  

I have created my own simple SeachModel class to holds Strings for each
selected dropdown choice.  In my custom session I wrap my model like:

    CompoundPropertyModel searchModel = new CompoundPropertyModel(new
SearchModel());

Then in my search page I can now do: 

    DropDownChoice countryDDC = new DropDownChoice("country", 
        new PropertyModel(model, "country"), new Model() {
                public Object getObject() {
                        SearchModel sm = (SearchModel) model.getObject();
                        String area = sm.getArea();
                        List<String> countries = 
areaManager.getCountryLabel(area);
                        return countries;
                }
        })

and everthing gets stored to and from the session automatically.

I have overriden the default choice so my options always have the correct
null values, eg: 

      protected CharSequence getDefaultChoice(Object selected) {
           return "<option value=\"\">All countries</option>";
      }

Only one problem still to solve - the one where if I select an area +
country + region combo - eg, N America - USA - Alabama, then change to a top
level area where the first country has no regions - eg, Africa - Alegeria -
the region dropdown sticks as the previously stored Alabama.  If I submit
the form, then the region dropdown gets reset OK - it's just not clearing
with the AJAX update to the country dropdown.  


Steve 







-- 
View this message in context: 
http://www.nabble.com/Combining-Ajax-and-non-Ajax-pages-tp15587166p15661322.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to