Actually, validation messages are now getting displayed for validation performed on components but I am still unable to get error messages that I have added to be displayed. For example, in the following code, I need a way to display the line "No PIN found for PIN" but I am not sure how to do that. Any ideas?
final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink("verifyPinLink") { @Override public void onSubmit(AjaxRequestTarget target, Form form) { // target.addComponent(feedback); // onError(target, 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); } } @Override public void onError(AjaxRequestTarget target, Form form) { target.addComponent(feedback); } }; jpalmer1026 wrote: > > I called target.addComponent for the feedbackpanel but still no luck. My > updated code is as follows: > > final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink("verifyPinLink") > { > @Override > public void onSubmit(AjaxRequestTarget target, Form form) { > target.addComponent(feedback); > onError(target, 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); > } > } > }; > > Erik van Oosten wrote: >> >> You did not call target.addComponent for the feedbackpanel or any of its >> parents. >> >> Regards, >> Erik. >> >> >> jpalmer1...@mchsi.com schreef: >>> 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? >> >> >> -- >> Erik van Oosten >> http://www.day-to-day-stuff.blogspot.com/ >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> >> > > -- View this message in context: http://www.nabble.com/Feedback-Messages-Not-Getting-Displayed-When-Using-AjaxSubmitLink-tp24117995p24118997.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org