Thanks. I think it will get more complicated as I wanted the effect to kick in after the page is rendered. What I do now is enable/disable individual components in AjaxCheckbox.onUpdate().
Mr Mean wrote: > > AFAIK there is no is such thing as isEnabledInHierarchy like there is > for visibility. > You can however use an IVisitor to quickly traverse all child > components of the container and set them to enabled / disabled. > If you do this in the onBeforeRender of the container you get pretty > much the behavior you want. > > Note that if you have a listview or some other repeater this is not > going to work since the items in the listview are created in the > onbeforeRender of the listview which is called after the > onbeforerender of the container. For items of listviews you need to > check the parent yourself in onpopulate. > > Maurice > > On Thu, Jul 3, 2008 at 6:53 AM, TH Lim <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> I have a form with 2 address blocks where each "block" is a >> WebMarkupContainer. The 1st block is the home address which basic the >> block >> no, postal code, street name etc. The 2nd block is the billing address. >> So >> when a user clicks on the check box stating that his home address is the >> billing address, 2nd block will be disabled. I can do this by disabling >> each >> field in the 2nd "block". Is there a way to disable this by block e.g. >> >> form.add(new AjaxCheckBox("sameAddressForBilling") >> { >> protected void onUpdate(AjaxRequestTarget target) >> { >> /* THIS DOES NOT WORK */ >> form.replace(billingAddressBlock.setEnabled(!((Boolean) >> getModelObject()))); >> target.addComponent(billingAddressBlock); >> >> } >> }); >> >> What am I missing here? >> >> TQ >> >> /lim/ >> >> -- >> View this message in context: >> http://www.nabble.com/Enable---Disable-Container-using-AJAX-tp18251827p18251827.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] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Enable---Disable-Container-using-AJAX-tp18251827p18255726.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]