Set current date in af:inputDate on double click using javascript in ADF

Sharing is Caring

This post is about a question that is asked on OTN forum. In this post, I’ll show you that how we can 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="" version="2.1" xmlns:f=""
    < contentType="text/html;charset=UTF-8"/>
        <af:document title="SetCurrentDate.jspx" id="d1">
            <af:resource type="javascript">
              function setDate(evt) {
                  var comp = evt.getSource()
                  comp.setValue(new Date());

            <af:form id="f1">
                <af:inputDate label="Label 1" id="id1">
                    <af:clientListener method="setDate" type="dblClick"/>

All done, as you can see that the javascript function is called using clientListener on double click event of input date component.

Set Current Date using Javascript

Cheers 🙂 Happy Learning

Related Posts

2 thoughts on “Set current date in af:inputDate on double click using javascript in ADF”

  1. Are you aware of any declarative solution to always have the time part of an input-date component defaulted to 00:00:00 or 23:59:59? We can set the or . However, with this approach, the user loses the ability to change the time from the component.


  2. Hi,
    I need to modify the existing code in Oracle ADF. There is transaction ID which is auto generated. we have one button named submit, before the button is pressed the status is new once we pressed the button the status will bu push to operation (it will go to web services) it will take some time without knowing this user clicked the button multiple times, so that it is over ridden. Now we need to modify the XML code .if the user clik the button once, the transaction id will be in the interface table we need to modify the code such that if the transaction id is present in interface table we need to get one popup and the transaction need not to be submitted. Please help me.


Leave a Reply

Your email address will not be published. Required fields are marked *