Disabling keyboard input in af:inputDate, restrict user to use calendar only – Oracle ADF

Sharing is Caring

Hello all,
this tutorial is about a requirement of restricting user to enter date through calendar only in ADF application
this trick (disabling keyboard input) was posted by Frank Nimphius (ADF Code Corner)

  • Drop a af:inputDate component on the page from the component palette

 

 

  • Now set its background color so that it looks like a disabled field

 

  • Now to make it’s input field disable, we have to write a small javascript function, copy this function and paste in your page source (XML)

<af:resource type="javascript">
          function enableCalendarOnly(evt) {
              evt.cancel();
          }
        </af:resource>

 

    • Now drop an af:clientListener under af:inputDate component to invoke javascript

  • Now set properties in af:clientListener as Method & Type

 

  •  Now run your page and see that input field is disabled for date component, now value can be selected using calendar only
    Disabling keyboard input

Cheers – Happy Learning 🙂

 

Related Posts

Leave a Reply

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