Hi,
I have two textfields with date picker and a select box with onchange
AjaxFormComponentUpdatingBehavior.
When I set the textfields visible to true everything is fine,
but when I set them to visible false after they was visible true the
textfields are hidden but the icons are still visible.
I figured out that it is possible to overwrite the icons but I would like it
more if the icons could just disappear when I set the parent textfields to
visible false.
Can please anyone help?
Thank you and best regards
Christoph
Example source:
<snip>
/* pauseVon */
_pauseVon = new TextField<String>("pauseVon", pauseVonModel);
_pauseVon.add(new DatePicker()
{
private static final long serialVersionUID=1L;
@Override
protected String getDatePattern()
{
return "dd.MM.yy 00:00";
}
});
_pauseVon.setRequired(true).setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true).setVisible(false);
add(_pauseVon);
/* pauseBis */
_pauseBis = new TextField<String>("pauseBis", pauseBisModel);
_pauseBis.add(new DatePicker()
{
private static final long serialVersionUID=1L;
@Override
protected String getDatePattern()
{
return "dd.MM.yy 00:00";
}
});
_pauseBis.setRequired(true).setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true).setVisible(false);
add(_pauseBis);
/* selectbox */
_selectArt.add(new AjaxFormComponentUpdatingBehavior("onchange")
{
private static final long serialVersionUID=1L;
protected void onUpdate(AjaxRequestTarget target)
{
if(selectArtModel.getObject().equals("1"))
{
_pauseVon.setVisible(true);
_pauseBis.setVisible(true);
target.addComponent(_pauseVon);
target.addComponent(_pauseBis);
}
else
{
_pauseVon.setVisible(false);
_pauseBis.setVisible(false);
target.addComponent(_pauseVon);
target.addComponent(_pauseBis);
}
}
});
_selectArt.setRequired(true).setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true).setVisible(true);
add(_selectArt);
</snip>