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

Reply via email to