0

I have 2 commandLink in my page. A user has to fill in the details in the input text box (I have used h:inputText for this and all fields are mandatory), and click on "Submit". If a user dont wish to fill in any of these fields there is a link provided below Submit for "Skipping this activitiy" . This skip link will redirect to some other page. Both Submit link and Skip link are h:commandLink. I cant use h:outputLink for Skip because when user clicks on Skip I want to call bean and do some business checks.

Now, when a user doesn't fill in any of the details in the fields, but instead clicks on Skip link, the required=true attribute of h:inputText is getting fired. I want this to get fired only when user clicks on Submit without filling in any details and not when he clicks on Skip link.

How to achieve this?

Vikas V
  • 3,176
  • 2
  • 37
  • 60

1 Answers1

0

Add immediate="true" to the commandLink.

It will make sure that all the input fields where immediate="true" hasn't been defined will be skipped in processing and no validation error will trigger.

Bharat Sinha
  • 13,973
  • 6
  • 39
  • 63