I am using an AjaxSubmitLink to submit form data. Using this, however, is preventing feedback messages from being displayed.
My code is as follows:
public class InitiateDeclarationPage extends EzdecBaseWebPage {
@SpringBean
private IDeclarationService declarationService;
AjaxFallbackLink reenterPinLink;
public InitiateDeclarationPage() {
final Declaration declaration = new Declaration(EzdecSession.getCurrentUser().getAccount(),
EzdecSession.getCurrentUser(), "", County.COOK, State.ILLINOIS);
// final FeedbackPanel feedback = new FeedbackPanel("feedback");
// feedback.setOutputMarkupId(true);
// add(feedback);
add(new FeedbackPanel("feedback"));
final Form form = new Form("initiateDeclarationForm", new CompoundPropertyModel<Declaration>(declaration));
form.add(new Button("submitButton") {
@Override
public void onSubmit() {
Declaration declaration = (Declaration) form.getModelObject();
declaration.setStatus(Status.OPEN);
ParcelIdentification pin = declarationService.findParcelIdentification(declaration.getPin());
if (pin == null) {
error("No PIN found for PIN " + getFormattedPIN(declaration.getPin()));
} else {
if (declarationService.initiateDeclaration(declaration)) {
EzdecSession.get().info("Declaration " + declaration.getTxNumber() + " created");
setResponsePage(new DeclarationPage(declaration, 0, pin));
} else {
error("Creating declaration with PIN: " + declaration.getPin());
}
}
}
});
final PINTextField pinText = new PINTextField("pin");
pinText.setRequired(true);
pinText.setOutputMarkupId(true);
form.add(pinText);
form.add(new DropDownChoice("county", Arrays.asList(County.values()))
.setRequired(true)
.setEnabled(false));
final WebMarkupContainer parent = new WebMarkupContainer("verifyPanelWmc");
parent.setOutputMarkupPlaceholderTag(true);
parent.setVisible(false);
form.add(parent);
final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink("verifyPinLink") {
@Override
public void onSubmit(AjaxRequestTarget target, Form form) {
Declaration declaration = (Declaration) form.getModelObject();
ParcelIdentification pid = declarationService.findParcelIdentification(declaration.getPin());
if (pid == null) {
error("No PIN found for PIN " + declaration.getPin());
} else {
InitiateDeclarationVerifyPanel decVerifyPanel = new InitiateDeclarationVerifyPanel("verifyPanel", pid);
parent.addOrReplace(decVerifyPanel);
parent.setVisible(true);
this.setEnabled(false);
reenterPinLink.setVisible(true);
target.addComponent(this);
target.addComponent(parent);
target.addComponent(reenterPinLink);
}
}
};
form.add(verifyPinLink);
reenterPinLink = new AjaxFallbackLink("reenterPinLink") {
@Override
public void onClick(AjaxRequestTarget target) {
this.setOutputMarkupPlaceholderTag(true);
parent.setVisible(false);
verifyPinLink.setEnabled(true);
target.addComponent(parent);
target.addComponent(verifyPinLink);
target.addComponent(pinText);
target.focusComponent(pinText);
this.setVisible(false);
target.addComponent(this);
}
};
form.add(reenterPinLink);
add(form);
}
}
Does anyone know how to fix this?
- Feedback Messages Not Getting Displayed When Using AjaxSub... jpalmer1026
- Re: Feedback Messages Not Getting Displayed When Usin... Erik van Oosten
- Re: Feedback Messages Not Getting Displayed When ... jpalmer1026
- Re: Feedback Messages Not Getting Displayed W... Jason Lea
- Re: Feedback Messages Not Getting Displayed W... jpalmer1026
- Re: Feedback Messages Not Getting Display... Luther Baker