Validation failed javascript callback in JSF

前端 未结 2 1506
时光说笑
时光说笑 2020-12-18 00:20

I have a template in which I can add a CSS error class to a div when the validation of a component has failed and it renders a pretty nice effect on the browser.

Now

2条回答
  •  抹茶落季
    2020-12-18 00:45

    Just let JSF/EL conditionally print the class based on FacesContext#isValidationFailed().

    You only need to ensure that this element is covered by ajax update/render.

    Another way would be hooking on the oncomplete event of an arbitrary PrimeFaces ajax based component. There's an args object available in the scope which in turn has a validationFailed property. E.g. or even .

    
    

提交回复
热议问题