Args ... I already had this problem some time ago but I can't remember what it
was exactly.
Wicket Ajax Debug:
INFO: Ajax request stopped because of precondition check, url:
./admin?1-5.IBehaviorListener.1-configTypes-panel-dialog-footer-buttons-0-button
I have two different Panels with almost the same functionality ... creating a
new Object and persist it. One is working fine but the other one not.
Works:
private Component save(final Form<ConfigType> form) {
return new AjaxSubmitLink(BUTTON_MARKUP_ID, form) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?>
f) {
Logger log =
LoggerFactory.getLogger(EditConfigTypeDialog.class);
ConfigManager cm =
EjbSupportImpl.getInstance().getConfigManager();
ConfigType configType = form.getModelObject();
if (configType.getId() != null) {
try {
ConfigType updated =
cm.updateConfigType(configType);
form.success("Successfully updated the
ConfigType.");
form.setModelObject(updated);
} catch (CcaException ex) {
form.error("Failed to update ConfigType");
log.error("Failed to update ConfigType", ex);
}
} else {
try {
ConfigType created =
cm.addConfigType(configType);
form.success("Successfully created the
ConfigType.");
form.setModelObject(created);
} catch (CcaException ex) {
form.error("Failed to create ConfigType");
log.error("Failed to create ConfigType", ex);
}
}
target.add(form);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?>
form) {
target.add(form);
}
@Override
public void onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag) {
replaceComponentTagBody(markupStream, openTag, "Save");
}
}.add(new ButtonBehavior(Buttons.Type.Primary));
}
Doesn't work:
private Component save(final Form<ConfigKey> form) {
return new AjaxSubmitLink(BUTTON_MARKUP_ID, form) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?>
f) {
Logger log =
LoggerFactory.getLogger(EditConfigKeyDialog.class);
ConfigManager cm =
EjbSupportImpl.getInstance().getConfigManager();
ConfigKey configKey = form.getModelObject();
if (configKey.getId() != null) {
try {
ConfigKey updated =
cm.updateConfigKey(configKey);
form.success("Successfully updated the
ConfigKey");
form.setModelObject(updated);
} catch (CcaException ex) {
form.error("Failed to update ConfigKey");
log.error("Failed to update ConfigKey", ex);
}
} else {
try {
ConfigKey created = cm.addConfigKey(configKey);
form.success("Successfully created the
ConfigKey");
form.setModelObject(created);
} catch (CcaException ex) {
form.error("Failed to create ConfigKey");
log.error("Failed to create ConfigKey", ex);
}
}
target.add(form);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?>
form) {
target.add(form);
}
@Override
public void onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag) {
replaceComponentTagBody(markupStream, openTag, "Save");
}
}.add(new ButtonBehavior(Buttons.Type.Primary));
}
I don't see a big difference why the other wouldn't work. You?
Marvin Richter
Software Developer
T +49 (0) 30 69 538 1099
M +49 (0) 174 744 4991
[email protected]<mailto:[email protected]>
JESTA DIGITAL GmbH Karl-Liebknecht-Str. 32 10178 Berlin, Germany
Gesellschaft mit beschränkter Haftung mit Sitz in Berlin
HRB Nr. 97990 Amtsgericht Charlottenburg
Geschäftsführer: Markus Peuler