You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ddawg <di...@gmail.com> on 2012/07/18 18:22:23 UTC

Nested external components in custom component

Hi, i'm trying to nest a formcomponent into a custom component of my own:

What I want is to have additional markup around my various form components.

Thus I created a ControlGroup panel as in the following:

*****ControlGroup.java****
public class ControlGroup extends Panel {
	public ControlGroup(String id) {
		super(id);
	}
}
*****ControlGroup.html****
<wicket:panel>
	<div class="control-group">
	<label class="control-label" for="control">Label</label>  
		<div class="controls">
			 <wicket:child id="control"/>
		</div>
	</div>
</wicket:panel>
****

I now would like to add this panel to a form component and nest an
additional formcomponent which substitutes <wicket:child>

For example:

****FormPage.java****
Form form ... 

ControlGroup c = new ControlGroup("controlgroup");
		
form.add(c);
c.add(new TextField("city"));

****FormPage.html****
<form wicket:id="form">
   <div wicket:id="controlgroup">
        <input wicket:id="city" type="text" /> 
   </div>
</form>
*************

What I want to have as an Output HTML at the end:

***********
<form>
	<div class="control-group">
	        <label class="control-label" for="control">Label</label>  
		<div class="controls">
			 <input type="text" ...>
		</div>
	</div>
</form>
*************

The error I get is:
For ControlGroup Components only raw markup is allow in between the tags but
not other Wicket Component

What is the proper way to realize my scenario?

Thanks!				

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Nested-external-components-in-custom-component-tp4650595.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: Nested external components in custom component

Posted by Andrea Del Bene <an...@gmail.com>.
Hi,

check class  org.apache.wicket.markup.html.border.Border. It should be 
more appropriate than a simple panel for what you are trying to do.
> Hi, i'm trying to nest a formcomponent into a custom component of my own:
>
> What I want is to have additional markup around my various form components.
>
> Thus I created a ControlGroup panel as in the following:
>
> *****ControlGroup.java****
> public class ControlGroup extends Panel {
> 	public ControlGroup(String id) {
> 		super(id);
> 	}
> }
> *****ControlGroup.html****
> <wicket:panel>
> 	<div class="control-group">
> 	<label class="control-label" for="control">Label</label>
> 		<div class="controls">
> 			 <wicket:child id="control"/>
> 		</div>
> 	</div>
> </wicket:panel>
> ****
>
> I now would like to add this panel to a form component and nest an
> additional formcomponent which substitutes <wicket:child>
>
> For example:
>
> ****FormPage.java****
> Form form ...
>
> ControlGroup c = new ControlGroup("controlgroup");
> 		
> form.add(c);
> c.add(new TextField("city"));
>
> ****FormPage.html****
> <form wicket:id="form">
>     <div wicket:id="controlgroup">
>          <input wicket:id="city" type="text" />
>     </div>
> </form>
> *************
>
> What I want to have as an Output HTML at the end:
>
> ***********
> <form>
> 	<div class="control-group">
> 	        <label class="control-label" for="control">Label</label>
> 		<div class="controls">
> 			 <input type="text" ...>
> 		</div>
> 	</div>
> </form>
> *************
>
> The error I get is:
> For ControlGroup Components only raw markup is allow in between the tags but
> not other Wicket Component
>
> What is the proper way to realize my scenario?
>
> Thanks!				
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Nested-external-components-in-custom-component-tp4650595.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
>



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