+1-888-365-2779
Try Now

Custom Datepicker For Forms

by M Waqar Haider
Publication date:
Jan 12, 2012, 08:17 AM

Version:
1.0

Compatibility:
  • Sitefinity 4.x

Price: $ 0

Custom datepicker control is developed to be used in forms for taking date inputs from user. You can define title, example and description labels of the fields from advance option of control designer pop in sitefinity backend forms. You can also define your custom design to style this date control.

Here is the JS for validation, which you can modify according to your need.

function IsFormValid() {
    var isFormValid = true;
     /*--fieldset is used as WrapperTag in this control, Which is being used for JS validation  --  */
    var dateFields = jQuery('#MyForm fieldset span:nth-child(2) table span input[type="text"]:first-child');
    var Dfield = jQuery('#' + dateFields[0].id);
    var Dspan = Dfield.parent().parent().parent().parent().parent().parent().parent().prev();
    Dspan.removeClass(InvalidClassName);
    if (!(Dfield.val().trim().length > 0)) {
        Dspan.addClass(InvalidClassName);
        isFormValid = false;
    }
return isFormValid ;
}

Installation

Copy the widget to the root or to a sub-folder of your Sitefinity website directory and follow the instruction available in the documentation.