I found I needed to use form.error("message") in the onSubmit method.
luther.baker wrote:
>
> I'm not at a computer to try this ... but I do this all the time so it
> definitely works like you're hoping.
>
> You've posted alot of code so its a bit difficult to trace what is
> commented
> out and what is not ... but starting with your original post, uncomment
> the
> following:
>
> final FeedbackPanel feedback = new FeedbackPanel("feedback");
> feedback.setOutputMarkupId(true);
> add(feedback);
>
> Now, be sure to add this (I think this is the part you're missing - or I
> missed in reading your snippets):
>
> feedback.setOutputMarkupPlaceholderTag(true);
>
> And then make sure you add it to the target in the submit handler:
>
> target.addComponent(feedback);
>
> I think you're doing/done all of this at one time with varied components -
> but my guess is that you've got to double check and make sure you're doing
> all three things specifically for the feedback panel.
>
> Hope this helps,
>
> -Luther
>
>
>
> Its hard to tell what
>
> On Fri, Jun 19, 2009 at 4:21 PM, jpalmer1026 <[email protected]>
> wrote:
>
>>
>> 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.
>> >>
>> >>
>> >> [email protected] 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: [email protected]
>> >> For additional commands, e-mail: [email protected]
>> >>
>> >>
>> >>
>> >
>> >
>>
>> --
>> 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: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
--
View this message in context:
http://old.nabble.com/Feedback-Messages-Not-Getting-Displayed-When-Using-AjaxSubmitLink-tp24117995p26844682.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]