Thanks so much for your reply. I tried to do it as following. But could not make it work. Obviously I have no idea what I am doing. I would appreciate very much if you will help me out here. Thanks.
private static class RequiredLabel extends SimpleFormComponentLabel
{
private static final long serialVersionUID =
5132250047993256659L;
//private boolean required;
FormComponent fc;
Behavior behaviour;
boolean behaviourAdded;
public RequiredLabel(String id, FormComponent fc)
{
super(id, fc);
//this.required = fc.isRequired();
this.fc = fc;
behaviour = new Behavior() {
public void onBeforeRender() {
getResponse().write("*");
// Can't remove the previously added
red asterisk
}
public void beforeRender() {
getResponse().write("*");
// does not add anything.
}
};
}
/*
@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
if (fc.isRequired()) {
getResponse().write("*");
}
}*/
@Override
protected void onBeforeRender() {
super.onBeforeRender();
if (fc.isRequired()) {
if (!behaviourAdded) {
add(behaviour);
behaviourAdded = true;
}
}
else {
if (behaviourAdded) {
remove(behaviour);
behaviourAdded = false;
}
}
}
}
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/editing-response-in-onComponentTag-tp4671062p4671076.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]
