You are viewing limited content. For full access, please sign in.

Question

Question

Limit date picker to on or after a specific date?

asked on September 1, 2020

I've seen a number of questions about limiting dates in the date picker in one way or another, but I would like to know if it is possible to limit the date picker to on or after a specific date (March 1, 2020). This date does not exist in a table. Thank you.

0 0

Answer

SELECTED ANSWER
replied on September 1, 2020

Use custom JavaScript as following:

$(document).ready(function(){
  var mindate='2020-03-01';
  $('#q22 input').attr('min',mindate);
});

q22 is the id of the field.

0 0
replied on September 2, 2020

Thank you so much, Xiuhong. I apologize, I neglected to say that this date is part of a collection. How can this JS be retained when the collection is repeated?

0 0
replied on September 2, 2020

I figured it out - thanks for your willingness to help!

1 0

Replies

You are not allowed to reply in this post.
replied on September 2, 2020

Hi Susan,

   Kindly Find the Below Example:

  1. Event Start Date
  2. Event Completion Date
  3. Event Deadline

-----

  • Event Start Date:

Start from today

 

  • Event Completion Date:

Start from selected start date.

 

  • Event Deadline:

From today and event start date

 

//*****Date Validation _____________________________
    var d = new Date();
    var year=d.getFullYear();
    var month=("0"+(d.getMonth()+1)).slice(-2);
    var day=("0"+d.getDate()).slice(-2);
//--------
//Event Date
    var v_Start_Date_maxDate=((parseInt(year)+5)+"-"+month+"-"+day);
    var v_Start_Date_minDate=(year+"-"+month+"-"+day);
    $('.v_Start_Date input').attr('max',v_Start_Date_maxDate);
    $('.v_Start_Date input').attr('min',v_Start_Date_minDate);
     
$('.v_Start_Date input').change(function(){
   if($(this).val()!='')
   {
    $('.v_Completion_Date input').val('');
    var com_d=$(this).val();
    var com_year=com_d.slice(-4);
    var com_month=com_d.slice(3, 5);
    var com_day=com_d.slice(0, 2);
    var v_Completion_Date_maxDate=((parseInt(com_year)+10)+"-"+com_month+"-"+com_day);
    var v_Completion_Date_minDate=(com_year+"-"+com_month+"-"+com_day);
    $('.v_Completion_Date input').attr('max',v_Completion_Date_maxDate);
    $('.v_Completion_Date input').attr('min',v_Completion_Date_minDate);

    $('.v_Registration_Deadline_of_Conference_Event input').val('');
    var v_Registration_Deadline_maxDate=v_Completion_Date_minDate;
    var v_Registration_Deadline_minDate=v_Start_Date_minDate;
    $('.v_Registration_Deadline_of_Conference_Event input').attr('max',v_Registration_Deadline_maxDate);
    $('.v_Registration_Deadline_of_Conference_Event input').attr('min',v_Registration_Deadline_minDate);
   }
    else
    {
     $('.v_Completion_Date input').val('');
     $('.v_Registration_Deadline_of_Conference_Event input').val('');
    }
});

$('.v_Completion_Date input').change(function(){
    $('.v_Registration_Deadline_of_Conference_Event input').val('');
});

 

warm regards,

Mohamed Farid

replied on September 2, 2020

I think this answer was meant for different question...

You are not allowed to follow up in this post.

Sign in to reply to this post.