You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Wolfgang <wi...@woifal.at> on 2012/10/02 15:07:14 UTC
HighlightForm without consuming FeedbackMessages
Hi everybody!
I have made a subclass of org.apache.wicket.markup.html.form.Form
with name HighlightForm
The purpose of this class is to give all Fields a css class "fieldError"
if validation failed for all FormComponents.
But in a way that it's generic - so I can use this class as DropIn
Replacement for normal Wicket-Form class.
I have uploaded a quickstart example here:
http://www.woifal.at/testHighlightForm.zip
So I visit all Children/FormComponents of the Form via an IVisitor and
add an AttributeModifier where I have overwritten the
isEnabled(Component) Method so to only enable the modifier when current
component is not valid.
So the invalid fields get the css class fieldError which makes there
background coloured in red. I don't show the feedbackMessages anywhere.
This worked with wicket 1.5.
Now with Wicket 6 the handling of FeedbackMessage have changed - so they
get marked to be cleared after they are rendered.
FeedbackMessage.markRendered()
As I don't render the messages they survive even when I input valid
values into the form and submit it again - validation continues to fail.
therefore in the
isEnabled(Component component)
method of the AttributeModifier I go through all FeedbackMessages and
call markRendered()
is this the right way? Is there a better place to do this?
start with
mvn jetty:run
Thank you very much
Wolfgang
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: HighlightForm without consuming FeedbackMessages
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
Try with latest 6.x.
There were two related improvements:
https://issues.apache.org/jira/browse/WICKET-4773
https://issues.apache.org/jira/browse/WICKET-4757
On Tue, Oct 2, 2012 at 4:07 PM, Wolfgang <wi...@woifal.at> wrote:
> Hi everybody!
>
> I have made a subclass of org.apache.wicket.markup.html.form.Form
> with name HighlightForm
>
> The purpose of this class is to give all Fields a css class "fieldError" if
> validation failed for all FormComponents.
> But in a way that it's generic - so I can use this class as DropIn
> Replacement for normal Wicket-Form class.
>
> I have uploaded a quickstart example here:
> http://www.woifal.at/testHighlightForm.zip
>
> So I visit all Children/FormComponents of the Form via an IVisitor and add
> an AttributeModifier where I have overwritten the
> isEnabled(Component) Method so to only enable the modifier when current
> component is not valid.
>
> So the invalid fields get the css class fieldError which makes there
> background coloured in red. I don't show the feedbackMessages anywhere.
>
> This worked with wicket 1.5.
> Now with Wicket 6 the handling of FeedbackMessage have changed - so they get
> marked to be cleared after they are rendered.
> FeedbackMessage.markRendered()
>
> As I don't render the messages they survive even when I input valid values
> into the form and submit it again - validation continues to fail.
> therefore in the
> isEnabled(Component component)
> method of the AttributeModifier I go through all FeedbackMessages and call
> markRendered()
> is this the right way? Is there a better place to do this?
>
> start with
> mvn jetty:run
>
>
> Thank you very much
> Wolfgang
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org