Saturday, 23 February 2013

Date control on a varchar type field


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">
        inputField : "<Your_field_name>", daFormat : "{$cal_dateformat}", ifFormat : "{$cal_dateformat}", showsTime : false, button : "
<Your_field_name>", 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.

No comments:

Post a Comment

Urdhva Tech Pvt. Ltd. Powered by Blogger.

Urdhva Tech

My Photo
SugarCRM Consultants Contact us at Skype : urdhvatech

Search This Blog


Stay connected Socially


Total Pageviews

Popular Posts