i guess we would have to add some sort of a flag to the form so that you know if it has been submitted in this request. please add an rfe and i will try to get to it this weekend maybe.

-Igor


On 3/24/06, karthik Guru <[EMAIL PROTECTED]> wrote:
I tried adding it as a separate behaviour. But since the behaviour
executes during fresh page instantiation, the components show up with
class attribute value 'valid'. I would rather not have any class
attribute set on the html element the first time the page is viewed.

component.add(new AbstractBehavior() {
                        public void onComponentTag(final Component component,
                                        final ComponentTag tag) {
                                if (((FormComponent)component).isValid()) {
                                        tag.getAttributes().put("class", "valid");
                                }else{
                                        tag.getAttributes().put("class", "invalid");
                                }
                        }
                });

How do i get past this?

On 3/23/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
> getMarkupAttributes() is transient, it doesnt live across requests thats why
> it doesnt show up.
>
> your solution is correct, but what i would do is add that as a separate
> behavior instead of merging it into the ajax behavior.
>
> -Igor
>
>
>
> On 3/23/06, Siddharth Agarwal <[EMAIL PROTECTED]> wrote:
> >
> > I add/modify the class attribute through
> AjaxFormComponentUpdatingBehavior. Is it too late by then?
> > i ask this since it doesn't show up in the ajax response.
> >
> > textField.add(new
> AjaxFormComponentUpdatingBehavior("onblur") {
> >             @Override
> >             protected void onUpdate(AjaxRequestTarget target) {
> >                 if (!getFormComponent().isValid()) {
> >
> getFormComponent().getMarkupAttributes().put("class",
> >                             "invalid");
> >                 }
> >                 target.addComponent(getFormComponent());
> >             }
> >
> >         });
> >
> >
> > But having it onComponentTag works ..
> >
> >         textField.add (new
> AjaxFormComponentUpdatingBehavior("onblur") {
> >             @Override
> >             protected void onUpdate(AjaxRequestTarget target) {
>
> >                 target.addComponent(getFormComponent());
> >             }
> >             protected void onComponentTag(final ComponentTag tag){
> >                 super.onComponentTag(tag);
> >                 if (!getFormComponent().isValid()) {
> >                     tag.put("class","invalid");
> >                 } else {
> >                     tag.put("class","valid");
> >                 }
> >             }
> >
> >         });
> >
> >
> > - Siddharth
>
>


--
-- karthik --


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to