You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Luther Baker <lu...@gmail.com> on 2009/04/04 20:15:52 UTC

feedback panel

I'd like to turn the background of a text input yellow - if it has errors.

Is there a standard way to do this? I have a feedback panel - and can write
some javascript. What about scanning the page for a feedback panel, and then
- reading an <li> attribute like id="form_name_" and corresponding that to
an field that needs to have a certain style .. ah - thats convoluted - but
can someone suggest a general way to add attributes to elements - I've seen
it but can't remember where?

Furthermore, is there a way to access the creation of the FeedbackPanel.LIs?

Thanks,

-Luther

Re: feedback panel

Posted by Maarten Bosteels <mb...@gmail.com>.
Have you searched the mailinglist archives ? I bet this has been asked before.

Anyway, see for example ShinyForm and its friends (in elephas)
http://tinyurl.com/cuyugo

For adding attribues, use AttributeAppender .

ErrorHighlightBehavior from elephas :

public class ErrorHighlightBehavior extends AttributeAppender {
        private static final long serialVersionUID = 1L;

        public ErrorHighlightBehavior() {
                super("class", true, new Model("error"), " ");
        }

        @Override
        public boolean isEnabled(Component component) {
                return !((FormComponent) component).isValid();
        }

Note: I have nothing to do with the elephas project, I just found some
inspiration in their code.

regards,
Maarten

On Sat, Apr 4, 2009 at 8:15 PM, Luther Baker <lu...@gmail.com> wrote:
> I'd like to turn the background of a text input yellow - if it has errors.
>
> Is there a standard way to do this? I have a feedback panel - and can write
> some javascript. What about scanning the page for a feedback panel, and then
> - reading an <li> attribute like id="form_name_" and corresponding that to
> an field that needs to have a certain style .. ah - thats convoluted - but
> can someone suggest a general way to add attributes to elements - I've seen
> it but can't remember where?
>
> Furthermore, is there a way to access the creation of the FeedbackPanel.LIs?
>
> Thanks,
>
> -Luther
>

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