I am facing a strange behavior in wicket compound property model. I have a
model object which I set to a form as its default model. This form is a
search form. The model is supplied to the form's constuctor from outside. 
Problem: When I enter value in the form for the first time, the model
attached is updated correctly with latest values from UI. However,
subsequently, the model does not get updated with new values entered on UI.
I have investigated and observed that framework is not attaching latest
values, input on UI, with the model from second time onward. Even when I try
to print input value of a textbox on console (on onblur event -
AjaxFormComponentUpdatingBehavior of textbox) it gives me old value.

Form's Code is given below:

public ProductSearchForm(String id, ProductPageModel productItem) {
            super(id);

            LOG.info("ProductSearchForm : productItem - " + productItem );

            List<LookupPageModel> productGroupList = null, productTypesList
= null, productStatusList = null;

            setDefaultModel(new CompoundPropertyModel<ProductPageModel>(
                    productItem));

            productName = new TextField<String>("productName",
                    new PropertyModel<String>(productItem, "productName"),
                    String.class);
            productName.add(new AttributeAppender("class", Model
                    .of("toggle")));
            productName.add(
                    new AjaxFormComponentUpdatingBehavior("onblur") {

                    protected void onUpdate(AjaxRequestTarget target) {
                        LOG.info("onUpdate ProdudtItem : "+
productName.getInput());
                    }
                });

            productName.add(new AttributeAppender("defaultValue", Model
                    .of(productNameEnterLabel)));

            productId = new TextField<String>("productId",
                    new PropertyModel<String>(productItem, "productId"),
                    String.class);
            productId.add(new AttributeAppender("defaultValue", Model
                    .of(productIdEnterLabel)));
            productId
                    .add(new AttributeAppender("class",
Model.of("toggle")));

            productTypesList = lookup.getProductTypes();
            productType = new DropDownChoice<LookupPageModel>(
                    "productType", new PropertyModel<LookupPageModel>(
                            productItem, "productType"), productTypesList,
                    lookupRenderer) {
                @Override
                protected String getNullKeyDisplayValue() {
                    return "Select Product Type";
                }
            };

            productGroupList = lookup.getProductGroups();
            productGroup = new DropDownChoice<LookupPageModel>(
                    "productGroup", new PropertyModel<LookupPageModel>(
                            productItem, "productGroup"), productGroupList,
                    lookupRenderer) {
                @Override
                protected String getNullKeyDisplayValue() {
                    return "Select Product Group";
                }
            };

            add(productGroup);

            productStatusList = lookup.getStatus();

            productStatus = new DropDownChoice<LookupPageModel>(
                    "productStatus", new PropertyModel<LookupPageModel>(
                            productItem, "fundStatus"), productStatusList,
                    lookupRenderer) {
                @Override
                protected String getNullKeyDisplayValue() {
                    return "Select Status";
                }
            };

            showProductSummary = new CheckBox("showProductSummary",
                    new PropertyModel<Boolean>(productItem,
                            "productSummaryRequired"));

            searchProduct = new AjaxButton("searchProduct") {

                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit(AjaxRequestTarget target, Form<?> form)
{

                    LOG.info("productName :" +
productName.getModelObject());
                    LOG.info("productName d :" +
productName.getDefaultModel());
                    LOG.info("productName d d:" + productName.getInput());

                }

            };

            resetProduct = new AjaxButton("resetProduct") {

                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit(AjaxRequestTarget target, Form<?> form)
{



                }

Help me to crack this and find the fix.

Thanks 
Suvo

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Compound-Property-Model-to-a-form-is-not-getting-updated-tp4667114.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to