Hi,

so I've had to add some mixins to a form to conditionally handle some form elements based on used input. A user selects a certain select list option, some fields get disabled or enabled as a result type thing.

The form is actually a BeanEditForm, not just a Form. Anyway, when my mixin returns back to the Page class event method which in turn updates the Zone, I lose all the values the user filled out in the form. Understandable enough, they were only living on the client side until the mixin-zone update occurred. As far as I recall Zones embedded in Forms don't really work out, hence my zone wraps around the form in its entirety.

Is there a good way to deal with this scenario? I was thinking there might be some way to tap into the binding to the Bean object that the BeanEditForm does during form submission. That would be ideal. I think the onPrepareFromForm method does what I want:

From BeanEditForm.java @ line 141

void onPrepareFromForm()
    {
        resources.triggerEvent(EventConstants.PREPARE, null, null);

        if (model == null)
        {
            Class beanType = resources.getBoundType("object");

            model = beanModelSource.createEditModel(beanType, 
resources.getContainerMessages());

            BeanModelUtils.modify(model, add, include, exclude, reorder);
        }
    }

Of course it's calling some internals and I don't think I can just do this from my page class. Is there some way to get the BeanEditForm to store the form values into the property bindings?


Also, I know it's possible to pass all the form values through as request parameters via AJAX and copy them into the property bindings of the form elements manually, but that seems pretty excessive. I hope that's not my best option =/.

Thanks,
Rich

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

Reply via email to