vinay
vinay

Reputation: 11

How to make fields mandatory?

I am working on an user registration form. I want to make certain fields mandatory. What JSF tags can I use to make the fields mandatory?

Upvotes: 0

Views: 4308

Answers (2)

Ilya Budu
Ilya Budu

Reputation: 119

You can use <p:inputText required="true", its easy and fast.

OR Use Bean Validation.

Bean Validation is a standard validation specification that allows us to easily validate domain objects by using a set of constraints declared in the form of annotations.

New built-in constraints: @Email, @NotEmpty, @NotBlank, @Positive, @PositiveOrZero, @Negative, @NegativeOrZero, @PastOrPresent and @FutureOrPresent

Upvotes: 0

Shervin Asgari
Shervin Asgari

Reputation: 24499

Use the required="true" attribute in <h:inputText>

Upvotes: 4

Related Questions