Hi, This is kind of tricky.
What you need is to attach AjaxFormSubmitBehavior's to the components that trigger changes, so that the entire form is submitted whenever a control's value changes. Then you can access the other controls' values through the form's model. The tricky part is that if some components have been marked as required or have validators, if these cheeks do not pass, their model won't be updated and you will get the last valid model value for those and not the current user input. So what I usually end up doing in situations like this is not mark any components as required and have all validation run in form.onModelValidating(). This has the effect that the AjaxFormSubmitBehavior's always (actually almost always, see below) update the form's model and the entire model is synchronized with the user's input at all times. The "almost always" above is because if the user's input violates the component's data type (e.g. if you have an Integer TextField and the user types in some alphanumeric string) then the component's model is not updated when you submit the entire form. In this case you need to handle/show the component's error. Perhaps someone has a better solution. Perhaps using simple AjaxFormComponentUpdatingBehavior's customized to also post the values of some additional controls will work better, I am not sure. I have not investigated this path as the approach I described above is a server-side solution that works. Marios On Wed, Apr 1, 2015 at 2:08 AM, Entropy <[email protected]> wrote: > I have a requirement to control the visibility of some controls and the > enabling of others based on certain legal combinations of values of various > controls on the page. I attached AjaxEventBehaviors to each control that > is > needed as input to this, but it seems like the values are other controls > aren't included, which is not terribly surprising. > > How can I get wicket to supply those values so I can make the decision of > what to enable/show/hide/disable? > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/onchange-control-visibility-according-to-multiple-controls-values-tp4670130.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
