I want to check the calendar input while the Save button is clicked. It means if I clicked other buttons or do anything else, it would not check input. How to express it ?
Asked
Active
Viewed 733 times
2 Answers
0
- Write a button onClick event handler function in javascript
- In the onClick event handler function, you can access the HTML document (DOM) ant its elements (For convenience you can use jquery). You can get the attribute value using this.

Jerome Anthony
- 7,823
- 2
- 40
- 31
0
you can use the required
tag in your calendar and use the process
tag in your Save commandButton
like this:
<h:form>
<p:inputText id="otherinput" value="Other inputs..."/>
<p:calendar id="calendar" required="true"/>
<p:commandButton process="calendar" value="Save"/>
<p:commandButton process="otherinput" value="Other Button"/>
</h:form>
This way when you click the "Save" button it will only process
the calendar
and not the other elements. Also when you click the "Other Button" it will not check the calendar.
I assumed here that you are using Primefaces as your 3rd party JSF component provider since you didn't mention any, let alone post any sample code you've tried.
Hope this helps

Fritz
- 1,144
- 1
- 13
- 21