This topic is locked
[SOLVED]

 has calendar issue been solved in 5.3?

3/15/2011 10:11:44 AM
PHPRunner General questions
V
Vienna author

[size="3"]I have someone who wants to use the day-month-year calendar dropdown instead of the javascript calendar.
Since it starts with 1910 that is a lot of unnecessary scrolling!
I have seen other scripts that let you specify the start year such as "myDate.setFullYear(2010,0,14);" would start the dating at January 14, 2010.
To make the dropdown calendar in PHPRunner 5.3 easier to use is there a way to modify the default script?
Say if I want the dropdown calendar to start with January 01, 2011 ?
Thank you![/size]
from output/commonfunctions.php



// returns HTML code that represents required Date edit control

function GetDateEdit($field, $value, $type, $fieldNum=0,$search=MODE_EDIT,$record_id="",&$pageObj)

{

global $cYearRadius, $locale_info, $jscode, $strTableName;

$is508=isEnableSection508();

$strLabel=Label($field);

$cfieldname=GoodFieldName($field);

$cfield="value_".GoodFieldName($field).'_'.$record_id;

if($fieldNum)

$cfield="value".$fieldNum."_".GoodFieldName($field).'_'.$record_id;

$tvalue=$value;





$time=db2time($tvalue);

if(!count($time))

$time=array(0,0,0,0,0,0);

$dp=0;

switch($type)

{

case EDIT_DATE_SIMPLE_DP:

$ovalue=$value;

if($locale_info["LOCALE_IDATE"]==1)

{

$fmt="dd".$locale_info["LOCALE_SDATE"]."MM".$locale_info["LOCALE_SDATE"]."yyyy";

$sundayfirst="false";

}

else if($locale_info["LOCALE_IDATE"]==0)

{

$fmt="MM".$locale_info["LOCALE_SDATE"]."dd".$locale_info["LOCALE_SDATE"]."yyyy";

$sundayfirst="true";

}

else

{

$fmt="yyyy".$locale_info["LOCALE_SDATE"]."MM".$locale_info["LOCALE_SDATE"]."dd";

$sundayfirst="false";

}



if($time[5])

$fmt.=" HH:mm:ss";

else if($time[3] || $time[4])

$fmt.=" HH:mm";



if($time[0])

$ovalue=format_datetime_custom($time,$fmt);

$ovalue1=$time[2]."-".$time[1]."-".$time[0];

$showtime="false";

if(DateEditShowTime($field))

{

$showtime="true";

$ovalue1.=" ".$time[3].":".$time[4].":".$time[5];

}

// need to create date control object to use it with datePicker

$ret='<input id="'.$cfield.'" type="Text" name="'.$cfield.'" size="20" value="'.$ovalue.'">';

$ret.='<input id="ts'.$cfield.'" type="Hidden" name="ts'.$cfield.'" value="'.$ovalue1.'">&nbsp;&nbsp;';

//$ret.='&nbsp;<img src="images/cal.gif" width=16 height=16 border=0 alt="'."Click Here to Pick up the date".'">';

$ret.='&nbsp;<a href="#" id="imgCal_'.$cfield.'">'.

'<img src="images/cal.gif" width=16 height=16 border=0 alt="'."Click Here to Pick up the date".'"></a>';

echo $ret;





return;

case EDIT_DATE_DD_DP:

$dp=1;

case EDIT_DATE_DD:

$retday='<select id="day'.$cfield.'" '.(($search == MODE_INLINE_EDIT || $search==MODE_INLINE_ADD) && $is508==true ? 'alt="'.$strLabel.'" ' : '').'name="day'.$cfield.'" ></select>';

$retmonth='<select id="month'.$cfield.'" '.(($search == MODE_INLINE_EDIT || $search==MODE_INLINE_ADD) && $is508==true ? 'alt="'.$strLabel.'" ' : '').'name="month'.$cfield.'" ></select>';

$retyear='<select id="year'.$cfield.'" '.(($search == MODE_INLINE_EDIT || $search==MODE_INLINE_ADD) && $is508==true ? 'alt="'.$strLabel.'" ' : '').'name="year'.$cfield.'" ></select>';

$sundayfirst="false";

if($locale_info["LOCALE_ILONGDATE"]==1)

$ret=$retday."&nbsp;".$retmonth."&nbsp;".$retyear;

else if($locale_info["LOCALE_ILONGDATE"]==0)

{

$ret=$retmonth."&nbsp;".$retday."&nbsp;".$retyear;

$sundayfirst="true";

}

else

$ret=$retyear."&nbsp;".$retmonth."&nbsp;".$retday;



if($time[0] && $time[1] && $time[2])

$ret.="<input id=\"".$cfield."\" type=hidden name=\"".$cfield."\" value=\"".$time[0]."-".$time[1]."-".$time[2]."\">";

else

$ret.="<input id=\"".$cfield."\" type=hidden name=\"".$cfield."\" value=\"\">";


// calendar handling for three DD

if($dp)

{

$ret.='&nbsp;<a href="#" id="imgCal_'.$cfield.'">'.

'<img src="images/cal.gif" width=16 height=16 border=0 alt="Click Here to Pick up the date"></a>'.

'<input id="ts'.$cfield.'" type=hidden name="ts'.$cfield.'" value="'.$time[2].'-'.$time[1].'-'.$time[0].'">';



//$ret.='&nbsp;<img src="images/cal.gif" width=16 height=16 border=0 alt="Click Here to Pick up the date"><input id="ts'.$cfield.'" type=hidden name="ts'.$cfield.'" value="'.$time[2].'-'.$time[1].'-'.$time[0].'">';





}


echo $ret;



return;

// case EDIT_DATE_SIMPLE:

default:

$ovalue=$value;

if($time[0])

{

if($time[3] || $time[4] || $time[5])

$ovalue=str_format_datetime($time);

else

$ovalue=format_shortdate($time);

}

echo '<input id="'.$cfield.'" type=text name="'.$cfield.'" size="20" value="'.htmlspecialchars($ovalue).'">';





return;;

}

}
V
Vienna author 3/15/2011

Where once I was blind...now I SEE!
I just discovered that all I had to do in ADD PROPERTIES for that field in 'Edit AS' (where I had checked Both the Dropdown and the Javascript calendar as field choices) was to put a 0 in the Start year field and a 5 in the end year field.
In the Add Form online window for those users choosing to use the day-month-year dropdown values this now gives them a year that started with 2011 and included up to 2016.
SOLVED!