Hi, Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov
On Fri, Jul 18, 2014 at 7:38 PM, Entropy <[email protected]> wrote: > I have a third party js library I am applying to my page. I have to mark > the > fields I want excluded with a particular HTML attribute. So I am > implementing a custom behavior to do the work, and I want the behavior to > act like it's an opt-in behavior instead of opt-out. > > So I wrote my behavior to take a set of components in it's constructor and > then, I want it to iterate through the text areas and text fields on the > components to mark the ones NOT provided wit the opt-out attribute. > > However, when I add an AttributeModifier to a tag in beforeRender I get an > exception: > Instead of doing: page.add(new MyBehavior(components)) do Behavior b = AttributeModifier.append(....); for (Component c : components) { c.add(b) } > > org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy > after render phase has started (page version cant change then anymore) > at > org.apache.wicket.Component.checkHierarchyChange(Component.java:3595) > ~[wicket-core-6.12.0.jar:6.12.0] > > I could move the code to the bind I suppose, but then user's of my > component > would have to make sure they added the behavior after ALL components, even > the ones that are going to be excluded, have been created. > > Is there an event between these two? Something the behavior can hook into > to do it's work after the construction of the components would be done, but > before beforeREnder since that seems to create issues? > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Behavior-to-modify-attributes-tp4666687.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] > >
