Get KoolPHP UI with 30% OFF!

Using multiple datepickers on the same form.

What I am trying to do is use datepicker for multple date required in a single form. Here is my code:
$datepicker = new KoolDatePicker("datetimepicker"); //Create calendar object
$datepicker->scriptFolder = "KoolPHPSuite/KoolControls/KoolCalendar/";//Set scriptFolder
$datepicker->DateFormat = "M jS, Y";
$datepicker->Value = $this->convert_date($cutoff); // converts the database stored format yyyymmdd to a human date format of Aug 27, 2015
$eodpicker = new KoolDatePicker("datetimepicker");
$eodpicker->scriptFolder = 'KoolPHPSuite/KoolControls/KoolCalendar/';
$eodpicker->styleFolder = 'default';
$eodpicker->DateFormat = "M jS, Y";
$eodpicker->Value = $this->convert_date($erDate);
//Change date and time format
<td width = '50px'>&nbsp;</td>
<td align = 'right' valign = 'center'><b>Commodity:&nbsp;</b></td>
<td align = 'left' valign = 'center'><input type = 'text' name = 'commodity' value = '<?php echo $commodity; ?>' /></td>
<td align = 'right' valign = 'center'><b>Early Return Date: </b></td>
<td align = 'left' valign = 'center'><?php echo $eodpicker->Render(); ?></td>
<td align = 'right' valign = 'center'><b>Cutoff:&nbsp;</b></td>
<td align = 'left' valign = 'center'><?php echo $datepicker->Render();?></td>
The form displays properly however when I select the eodpicker I see date for both of the datepickers highlighted, and then the original datepicker I am unable to access.... If anyone has any insite into this it would be greatly appreciated.
Posted Sep 16, 2015 Kool
Anthony Amolochitis
The problem with your date pickers is that they are named the same.
Try giving each datepicker a different name. That should fix the issue
Posted Nov 28, 2015 Kool -
ADavid Wulkan
I was having the same problem until I found this:
I thought the parameter was a type it's not, it's the calendar name.
This worked for me.
<?php include "inc/header_inc.php"; ?>
<!-- test.php -->
<!-- 2016011 This code returns start and end date calendars-->
<!--  -->
	require_once $KoolControlsFolder."/KoolCalendar/koolcalendar.php";	
	$datepicker1 = new KoolDatePicker("datepicker1"); //Create calendar object
	$datepicker1->scriptFolder = $KoolControlsFolder."/KoolCalendar";//Set scriptFolder
	$datepicker2 = new KoolDatePicker("datepicker2"); //Create calendar object
	$datepicker2->scriptFolder = $KoolControlsFolder."/KoolCalendar";//Set scriptFolder
	//Change date and time format
	$datepicker1->DateFormat = "M jS, Y";
	$datepicker2->DateFormat = "M jS, Y";
        <form id="form1" method="post">	
           <td width="150px" style="vertical-align:top">
            <div style="padding-top:10px;padding-bottom:10px;width:100px;">
              Start date:
              <?php echo $datepicker1->Render();?>
                if($datepicker1->Value!=null) {
                   echo "<b>Start date:</b> ".$datepicker1->Value;
          <td width="50px"></td>
          <td width="150px" style="vertial-align:top">
            <div style="padding-top:10px;padding-bottom:10px;width:100px;">
              End date:
              <?php echo $datepicker2->Render();?>
                  if($datepicker2->Value!=null) {
                     echo "<b>End date:</b> ".$datepicker2->Value;
          <td width="15px"></td>
          <td width="150px" style="vertical-align:bottom">
              <div style="padding-top:10px;padding-bottom:10px;width:100px;">
                <input type="submit" value="Submit" />
Posted Jan 17, 2016 , edited Jan 17, 2016 Kool