tags:

views:

156

answers:

1

I am putting a TextField and a DropDownChoice inside a FormComponentPanel which is supposed to use setConvertedInput to TextField's value concatenated with DropDownChoice's value. However, I would like to put the markup for the FormComponentPanel inside a wicket:fragment in the markup file that contains the containing form.

Here's an abrreviated version of what I tried so far:

OptionsPanel.java

... some stuff not shown here ...
DurationFormComponentPanel durationFormComponentPanel = new DurationFormComponentPanel("estimated_duration");
add(new Fragment("estimatedDuration", "duration_fragment", OptionsPanel.this));

OptionsPanel.html

<span wicket:id='estimatedDuration'></span>
<wicket:fragment wicket:id='duration_fragment'>
<input wicket:id='estimated_duration' value='3' />
<select wicket:id='needed_time_unit'>
    <option>weeks</option>
    <option>days</option>
</select>
</wicket:fragment>

The end result of this atm is that the markup for the FormComponentPanel is empty.

A: 

You have to add the inner inputs components to the fragments, in this fashion:

Fragment f = new Fragment("estimatedDuration", "duration_fragment", OptionsPanel.this);
f.add(new TextField("estimated_duration", new Model<String>("3"));
f.add(...);    
[form.]add(f);
Jawher
Ok, but where does my FormComponentPanel fit into this?
Sam