23
February

0 Comments | 0 Shares | Urdhva Tech | Tags: Datetime

Greetings!

If you wish to give a date control on a "NON" date type field, this code snippet is what you need!

Step 1: Create a file under custom/modules/<module_name>/views named view.edit.php Do check if that file already exists under modules/<module_name>/views, if yes, copy over to custom folder and add/edit function display with following code.



global $timedate;
        $cal_dateformat = $timedate->get_cal_date_format();
        $calendar = <<<EOQ
            <script language = "javascript">
            Calendar.setup({
        inputField : "<Your_field_name>", daFormat : "{$cal_dateformat}", ifFormat : "{$cal_dateformat}", showsTime : false, button : "
<Your_field_name>", singleClick : true, step : 1
            });
            </script>
EOQ;
        echo $calendar; 

 


Change the <Your_field_name> matching with correct field name.


C'est tout!! Yup, just 1 step!

Feel free to leave your comments.
Download attachments:
Comments
  • No Comments Found.
Post your comment