Date control on a varchar type field

sugarcrmdevelopers —  April 24, 2013

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
        inputField : “”, daFormat : “{$cal_dateformat}”, ifFormat : “{$cal_dateformat}”, showsTime : false, button : “
“, singleClick : true, step : 1
        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.