Hello all, I'm beating my head on the wall and not really sure what I'm doing
wrong... :(

I am attempting to use a CheckGroup to contain several choices - maybe it's
even the wrong way to go about it.  I followed the example on the Wicket
webpage, but it's not working for me.

Here's my HTML:

<input type="checkbox" name="filter_by_merchant" id="filter_by_merchant"
wicket:id="filterByMerchantCheckbox" value="1" onchange="var
l=$('optional_filter_by_merchant'); if (this.checked){l.show()} else
{l.hide()}"/>
<label for="filter_by_merchant">Merchant</label>

<ul id="optional_filter_by_merchant" class="inline optional-indent">
        <li wicket:id="merchants">
                <input type="checkbox" name="filter_by_merchant_rich_clicks"
id="filter_by_merchant_rich_clicks" wicket:id="merchantCheckboxComponent" />
                <label for="filter_by_merchant_rich_clicks"
wicket:id="merchantCheckboxLabel">Rich Clicks</label>
        </li>
</ul>



And I have a method to populate this section:

private CheckGroup createMerchantFilterMerchantsCheckboxes(Model model) {
        CheckGroup group = new CheckGroup("merchantCheckboxGroup");
        ListView merchants = new ListView("merchants",
MerchantOption.loadOptions()) {
                private static final long serialVersionUID = 1L;

                protected void populateItem(ListItem item) {
                        item.add(new Check("merchantCheckboxComponent"));
                        item.add(new Label("merchantCheckboxLabel", new
PropertyModel(item.getModel(), "value")));
                }
        };
        group.add(merchants);

        return group;
}


When I call this method from my page class, it's pretty simple:

ReportTypeOption def = new ReportTypeOption();
Model model = new Model(def);
setModel(model);
Form form = new Form("reportForm");
add(form);
form.add(createMerchantFilterMerchantsCheckboxes(model));


But, every time I hit the page, it throws
"org.apache.wicket.WicketRuntimeException: CheckGroup
[0:reportForm:merchantCheckboxGroup] contains a null model object, must be
an object of type java.util.Collection".

>From what I can tell, this code is exactly like what's on the demo page. 
Further, I've tried reading all the docs I can find and have even tried
stepping through the code.  But, I'm not getting anywhere.  Does anybody
have any ideas on how to get that model populated?  It's complaining that
the CheckGroup doesn't have a model associated, not the Check, and indeed
it's not initialized with a model.  Should it be?  Which one?
-- 
View this message in context: 
http://www.nabble.com/Null-model-with-CheckGroup-tp17419490p17419490.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