You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Craig L <cl...@spinnphr.com> on 2014/04/30 17:39:40 UTC

setVisible on a WebMarkupContainer during initial page render based on ListChoice value

Hello, new to Wicket so I apologize if this is an easy architecture issue. We
are using version 1.4.18.

I have a form with a ListChoice using a model to pull data from a db. Based
on the selection in the ListChoice I need to hide/show a WebMarkupContainer
(wmc) that contains a label and text field.

I have an AjaxFormComponentUpdatingBehavior("onchange") behavior added to
the ListChoice which works just fine to determine the selected value and
toggle the visibility of the wmc...once a change in selection is made in the
ListChoice.

My problem is setting the initial visible state of the wmc during the
initial page rendering based on the ListChoice selection. 

I stop the dugger where I add the wmc to the form and at that point the
ListChoice model hasn't yet determined what the initial selection will be so
I can't determine the wcm's initial visibility. 

I have tried several different types of behaviors and methods on the
ListChoice and wcm to set the initial visibility but I keep receiving the
error *"Cannot modify component hierarchy after render phase has started
(page version cant change then anymore)" *whenever I make a call to the
wcm's setVisible method. 

What combo of behavior/event on which component should I be using to allow
me to make the wcm.setVisible call during the initial rendering of the page?

Or, alternately, is there a way to force the wcm initial load to wait for
the ListChoice model to complete so I can set the initial visibility in the
constructor?

Thanks in advance.
Craig



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/setVisible-on-a-WebMarkupContainer-during-initial-page-render-based-on-ListChoice-value-tp4665632.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: setVisible on a WebMarkupContainer during initial page render based on ListChoice value

Posted by Craig L <cl...@spinnphr.com>.
Hi Gabriel,

I added an isVisible() to the WebMarkupContainer and that is working as I
hoped. I have bookmarked the bestpractices page for future reference. Thank
you for pointing me in the right direction.

Craig

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/setVisible-on-a-WebMarkupContainer-during-initial-page-render-based-on-ListChoice-value-tp4665632p4665638.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: setVisible on a WebMarkupContainer during initial page render based on ListChoice value

Posted by Gabriel Landon <gl...@piti.pf>.
Hi,

Please read :
http://wicket.apache.org/guide/guide/bestpractices.html#bestpractices_5
http://www.mail-archive.com/dev@wicket.apache.org/msg07123.html

You can override isVisible() or do the setVisible into the onConfigure()
method.

Regards,

Gabriel.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/setVisible-on-a-WebMarkupContainer-during-initial-page-render-based-on-ListChoice-value-tp4665632p4665633.html
Sent from the Users forum mailing list archive at Nabble.com.

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