form components have a isValid() method that returns false if there are errors

you can traverse form's children and call isvalid on them, and collect the list

see Form.visitFormComponents()

-Igor


On 10/11/06, Stefan Lindner <[EMAIL PROTECTED]> wrote:
I have a form with required input fields. The Form has an AjaxsubmitButton. Now I want to mark each missing required field. How can I determine which field is missing?
Unless each missing field is provieded, the Form's model object remains null.
My idea was to place a hidden FeedbackPanel on the Panel ofr Form. The feedback Panel has a (protected) method "getCurrentMessges" which results in a List of FeedbackMessages. Each FeedbackMessage has e mehtoc called "getReporter" that gets the reporting component. So I could do something like

          @Override
          protected void onError(AjaxRequestTarget target, Form form) {

          List<FeedbackMessge> list = feedbackPanel.getCurrentMessages();
          for (FeedbackMessage message : list) {
               if (message.getReporter == componentA) {
                    componentA.add(new AttributeModifier("class", true, new Model<String>("requiredFormInput")));
                     target.addComponent(componentA);
               }

But the getCurrentMessages method is protected and I have to declare my own  FeedbackPanel with an overwritten getCurrentMessagesmethod.
is there another mechanism to determine the Form comonents, that cause errors (not only required fields)?

Stefan Lindner

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to