Igor Vaynberg wrote:
mobile.add(new AjaxFormComponentUpdatingBehavior("onblur") {
          protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
              mobile.validate();
              ajaxRequestTarget.addComponent(feedbackPanel);
          }
===> protected void onError(target) { target.addcomponent(feedbackpanel);}
      });

-igor

On Sun, Apr 26, 2009 at 4:52 PM, Jason Wang <[email protected]> wrote:
Hi all,


I got a weird error when doing a form component validation. When it fails on
the validation the feedback panel is not updated with the error message. The
log shows this:

Component-targetted feedback message was left unrendered. This could be
because you are missing a FeedbackPanel on the page.


Well, I added the FeedbackPanel on the form belonging to a webpage. And all
the error messages sent to the panel can be properly displayed. Just the one
triggered with a component.validate failed to display.

The example below can reproduce this error I got:
Java:

public class Example extends WebPage {
  public Example(){
      Form signupForm = new Form("signUpForm");
      final FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
      feedbackPanel.setEscapeModelStrings(false).setOutputMarkupId(true);
      signupForm.add(feedbackPanel);

      final RequiredTextField<String> mobile = new
RequiredTextField<String>(
              "mobile");
      mobile.setLabel(new Model<String>("mobile")).add(new
PatternValidator("^[1-9]([0-9]{8,14})"));

      mobile.add(new AjaxFormComponentUpdatingBehavior("onblur") {
          protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) {
              mobile.validate();
              ajaxRequestTarget.addComponent(feedbackPanel);
          }
      });
      signupForm.add(mobile);

      add(signupForm);
  }
}

Html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<html
      xmlns="http://www.w3.org/1999/xhtml";
      xmlns:wicket="http://wicket.sourceforge.net/";
      xml:lang="en"
      lang="en">
<body>



      <form wicket:id="signUpForm" class="signUpForm">
          <span wicket:id="feedback">[feedbackmessages will be put
here]</span>
          <input wicket:id="mobile" id="mobile" type="text" size="20"
class="signUpForm-input"/>
                </form>

</body>
</html>





Cheers,
Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Thanks. That works fine.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to