set current date in af:inputDate component on double click of the mouse. For this, we need to use a simple javascript function.
Here we have an inputDate component on the page and added javascript function as a resource in the page. See page XML source
- <?xml version='1.0' encoding='UTF-8'?>
- <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
- <jsp:directive.page contentType="text/html;charset=UTF-8"/>
- <f:view>
- <af:document title="SetCurrentDate.jspx" id="d1">
- <af:resource type="javascript">
- function setDate(evt) {
- var comp = evt.getSource()
- comp.setValue(new Date());
- }
- </af:resource>
- <af:form id="f1">
- <af:inputDate label="Label 1" id="id1">
- <af:clientListener method="setDate" type="dblClick"/>
- </af:inputDate>
- </af:form>
- </af:document>
- </f:view>
- </jsp:root>