Code Monkey home page Code Monkey logo

jquery.datepicker's Introduction

This is a simple and clean jQuery date picker. The goal is for it to be minimalistic and small. It can be shrank to less than 3KB uses Google Closure and gzip's down to ~1.2KB. Tested using jQuery 1.6.2 and Chrome 14, FF6 and IE9. It hopefully works in some older browsers as well.

We have further enhanced it to working with TeamSite FormsPub.  YOu will need to include jQuery to use this plugin

//get forms pub iframe and document into which to insert jquery events and styles
var formframedocument = window.top.formframe.document;

// insert datePicker css since DCT doesn't allow stylesheet link html
var $head = $(formframedocument).contents().find("head");                
$head.append($("<link/>", 
           { rel: "stylesheet", href: "http://15.126.216.81/iw/datepicker/datePicker.css", type: "text/css" }));


var startDateIWItem = IWDatacapture.getItem("/product-content-catalogue/Compliance/productCompliance/startDate");
startDateIWItem.setReadOnly(true);
var endDateIWItem = IWDatacapture.getItem("/product-content-catalogue/Compliance/productCompliance/endDate");
endDateIWItem.setReadOnly(true);

//find inputs in iframe form document
var startDateInput = $(formframedocument).find("input[name='product-content-catalogue/Compliance/productCompliance/startDate']");
var endDateInput = $(formframedocument).find("input[name='product-content-catalogue/Compliance/productCompliance/endDate']");

//set min
var minDateLimit = new Date(2012, 0, 0);
minDateLimit.setHours(0, 0, 0, 0)

//determine if a default date is present
var startDateDefault = true;
var endDateDefault = true;
//alert(startDateIWItem.getValue());
if (startDateIWItem.getValue() == null || startDateIWItem.getValue() == "") {
    startDateDefault = true;
} else {
    startDateDefault = false;
}
if (endDateIWItem.getValue() == null || endDateIWItem.getValue() == "") {
    endDateDefault = false;
} else {
    endDateDefault = false;
}

// initialize datePicker on the date field
startDateInput.datePicker();
endDateInput.datePicker();

// bind datePicker toggle command to focus event of the date field
startDateInput.focus(function() {
     $(this).datePicker({command: 'toggle'});
endDateInput.focus(function() {
     $(this).datePicker({command: 'toggle'});

jquery.datepicker's People

Contributors

larrybattle avatar pratikpparikh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.