Forum Stats

  • 3,852,536 Users
  • 2,264,112 Discussions
  • 7,905,096 Comments

Discussions

Date without weekend

PauloFlesch
PauloFlesch Member Posts: 67 Blue Ribbon
edited Apr 22, 2013 7:45AM in APEX Discussions
Hello,
I need to block the weekends in Date Picker item.
It must appear disabled.
Tagged:

Answers

  • Kiran Pawar
    Kiran Pawar Member Posts: 2,951 Bronze Crown
    edited Apr 22, 2013 7:45AM
    Hello Paulo,

    >
    PauloFlesch wrote:

    I need to block the weekends in Date Picker item.
    It must appear disabled.
    >

    There is no in-built APEX functionality to achieve this with the datepicker item.
    Here is a workaround for this:
    <ul>
    <li>
    Change the Display As property of the item to Text Field
    </li>
    <li>
    Add following to the HTML Form Element Attributes :
    class="datefield"
    OR if you are using APEX 4.2 add datefield to the HTML Form Element CSS Classes
    </li>
    <li>
    In the Page Attributes -> Execute when Page Loads section add following:
    /* create datepicker */
    $(document).ready(function() 
    {
      $("input.datefield").datepicker(
       {
        dateFormat: 'dd-M-yy',
        constrainInput: true,
        beforeShowDay: $.datepicker.noWeekends,
        showOn: "both",
        changeMonth: true,
        changeYear: true,
        buttonImage: "#IMAGE_PREFIX#asfdcldr.gif",
        buttonImageOnly: true
       });
    });
    </li>
    </ul>

    Here is a working example:

    http://apex.oracle.com/pls/apex/f?p=52380:1:111382063608046:::::

    Hope it helps!
    Regards,
    Kiran
This discussion has been closed.