PHP Classes

Jquery Calendar Render: Render a date picker using jQuery calendar plugin

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 65%Total: 463 All time: 6,063 This week: 42Up
Version License PHP version Categories
jquery-date-picker 1Freeware5HTML, PHP 5, Time and Date
Description 

Author

This is a simple class that can render a date picker using jQuery calendar plugin.

It outputs HTML and JavaScript code to display a form text input that will take a calendar date picked by the user using the jQuery Calendar plugin.

The name of the text form input and other properties are configurable.

Picture of Anthony Amolochitis
  Performance   Level  
Name: Anthony Amolochitis <contact>
Classes: 10 packages by
Country: United States United States
Age: 44
All time rank: 1138166 in United States United States
Week rank: 180 Up22 in United States United States Up

Recommendations

I need to pick a date and return it to a form
I require the date to return in MySQL/Oracle format

Appointment setting and callback program
Log phone calls and set appointment dates and times for leads

Datepicker compatible with single page AJAX PHP application
PHP date picker that posts date variable to MySQL

Example

<?php


/**
 * Description of DatePickerBuild
 * Use this class to render a text box that uses a jquery calendar.
 * It is assumed that the jquery libraries are already included in the html
 * includes section.
 * @author aamolochitis
 */
class JqueryDatePickerBuildDefault
{
    var
$name = '';
    var
$boxProperties = '';
    var
$boxValue = '' ;
   
   
/**
     * Pass in parameters for the input box to have it name/id, styling, and value
     * @param string $name
     * @param string $boxProperties
     * @param string $boxValue
     */
   
function __construct( $name , $boxProperties, $boxValue)
    {
       
$this->name = $name ;
       
$this->boxProperties = $boxProperties ;
       
$this->boxValue = $boxValue ;
    }
   
/**
     * Return an input box that uses jquery calendar default functionality
     * @return string|null
     */
   
function Render()
    {
        if( empty(
$this->name ) ){ return null ;}
       
        return
'
        <script>
            $(function() {
                $( "#'
. $this->name .'" ).datepicker();
            });
        </script>
        <input type="text" id="'
. $this->name .'" name="'. $this->name .'" '. $this->boxProperties .' value="'. $this->boxValue .'">';
    }
   
}

$name = 'name';
$style= ' style="height:35px; width:200px; font-size:12pt; border:none; color:grey; " ' ;
$curDate = date( 'm/d/Y') ;

$date = new JqueryDatePickerBuildDefault( $name , $style , $curDate );

?>

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
  <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
</head>
<body>
 
    <fieldset style="border:1px solid lightgrey; border-radius: 4px; width:200px;">
        <legend style="border:1px solid lightgrey; border-radius: 4px; padding:4px; color:grey;">
            Pick A Date
        </legend>
        <?php echo $date->Render(); ?>
</fieldset>
 
</body>
</html>


  Files folder image Files (2)  
File Role Description
Plain text file ExampleUsage.php Example Example use of the class
Plain text file JqueryDatePickerBuildDefault.php Class Build basic usage of a jquery calendar

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:463
This week:0
All time:6,063
This week:42Up
User Ratings User Comments (1)
 All time
Utility:91%StarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:-
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:65%StarStarStarStar
Rank:588
 
Nice little utility.
8 years ago (Richard Rowley)
70%StarStarStarStar