0

In my application I want to check null validation from managebean by Customvalidator. I am using jsf1.2 & I have a <h:inputText> and a submitButton in a form , when I click submitButton leaving the inputText field empty , I want to generate a message from backing bean. One more thing I have also set attribute validator with a backing bean method named#{manageBean.validateField}. How I can implement this. Thanks ,

Diganta
  • 671
  • 3
  • 11
  • 27

1 Answers1

0

If you just want to check for required fields, you can just use the required and requiredMessage attribute of the component.

<h:inputText id="fldName" value="#{managedBean.property}" required="true" requiredMessage="Please enter value..."/>
<h:message for="fldName"/>
Vrushank
  • 2,763
  • 3
  • 27
  • 41
  • Thanks Vrushank for reply, But I have a requirement to change styleClass of row containing error component dynamically at runtime, so I want to check this validation from backing bean. How I can this from `backing bean`. – Diganta Mar 12 '13 at 06:43
  • You mean to say by using validator attr, you want to change styleClass? – Vrushank Mar 12 '13 at 06:47
  • In that case, bind the input component to the view via `binding` attribute. See this answer for a better example with explanation - http://stackoverflow.com/a/14457883/1055089 – Vrushank Mar 12 '13 at 06:59