On Wed, Oct 17, 2012 at 8:22 AM, delta458 <delta...@hotmail.com> wrote:
> Hi Martin,
> thanks so much for the replies... almost done, some little questions still
> there.. I got it working, could you verify that its right what I made? :)
>
> 1)
> *//Had Error: Wrong number of type arguments, required 2 - It works when I
> do  IVisitor<Component,Void> ;-)

Trust the compiler and follow his recommendations ;-)

> public class ShinyFormVisitor implements IVisitor<Component>,Serializable {*
>
>     Set visited = new HashSet();
>
>     public void component(final Component c, final IVisit<Void> visit
> /*[2]*/) {
>         if (!visited.contains(c)) {
>             visited.add(c);
>             c.add(new RequiredBorder());
>             c.add(new ValidationMsgBehavior());
>             c.add(new ErrorHighlightBehavior());
>         }
>     }
>
> ...
>
>     private class ValidationMsgBehavior extends Behavior {
>
>         public void onRendered(Component c) {
>             FormComponent fc = (FormComponent) c;
>             if (!fc.isValid()) {
>                 String error;
>                 if (fc.hasFeedbackMessage()) {
>                   * //Had error, now working with this.. thats right?
>                     error =
> fc.getFeedbackMessages().first().getLevelAsString();*

fc.getFeedbackMessages().first(FeedbackMessage.LEVEL_ERROR).toString();

Or you may use the default registered converter to transform it to
String. But this is more advanced and most probably you don't need it.

>
>                 } else {
>                     error = "Your input is invalid.";
>                 }
>                 fc.getResponse().write(
>                         "<div class=\"validationMsg\">" + error + "</div>");
>             }
>         }
>     }
> }
>
>
> 2) Do you know any good wicket tutorials/example where I can learn how to
> work with customized FeedbackMessages?

The source code is the best. It is really simple.
Check 
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java

>
> thanks..
>
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/highlight-invalid-fields-with-custom-Validation-Framework-tp4652949p4653024.html
> Sent from the Users forum 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
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to