This topic is locked

dropdown boxes for dates

10/30/2008 5:12:42 PM
PHPRunner General questions
R
riverratrich author

I am using the dropdown boxes only option as a date picker for adding and updating a date field. PHP-Runner ultimately fills the Year box with the data range 1908-2018.
It seems that it uses a function called BuildEditControl to create the HTML Select box but I can't for life of me follow the internal logic.
But what I want to know is, how can I change this range?

G
Geoffww 10/30/2008

You can edit this range for the DatePicker in the file calendar.html in the root directory of your project. Or in the PHPRunner5.0\source\calendar.html file.

Here is the code on or about line# 135
Edit the -100 and +10 values as needed.
[codebox]var currentyear=(new Date()).getFullYear();

var lo=currentyear-100;

var hi=currentyear+10;[/codebox]
You can edit this range for the DropMenus in the file commonfunctions.php in the /include directory of your project. Or in the PHPRunner5.0\source\include\commonfunctions.php file.

Here is the code on or about line# 2287
Edit the -100 and +10 values as needed where they appear next to the "+1900".
[codebox]// write years dropdown

function WriteYears($y)

{

$tm=localtime(time(),true);

$ret='<option value=""> </option>';

$firstyear=$tm["tm_year"]+1900-100;

if($y && $firstyear>$y-5)

$firstyear=$y-10;

$lastyear=$tm["tm_year"]+1900+10;

if($y && $lastyear<$y+5)

$lastyear=$y+10;

for($i=$firstyear;$i<=$lastyear;$i++)

$ret.='<option value="'.$i.'" '.($i==$y?"selected":"").'>'.$i."</option>\r\n";

return $ret;

}[/codebox]