Hi,
I am trying to use SimpleAttributeModifier to make an ADD MORE link
invisible once the maximum number of text fields that it adds have been
reached.
But I can not get it to render the link component.
My code:
addLink = new AjaxSubmitLink("addRow", form) {
private static final long serialVersionUID =
8103461308100688184L;
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
if (tech_count < max_tech_contacts) {
lv.getModelObject().add(new String());
if (target != null) {
target.addComponent(
techPanel);
tech_count++;
}
if (tech_count >= max_tech_contacts)
addLink.add(new SimpleAttributeModifier( "style",
"display:none"));
}
}
};
addLink.setDefaultFormProcessing(false);
form.add(addLink);
I am guessing it adds style="display:none" to the addLink, but does not
render it again, so the link is still visible.
Thanks,
Anna