manual date entry

manual date entry

  

hi all, good day.

how do i disable manual entry of date of birth filed.

user has to choose via date picker only 

how do i achieve this.

the  bug  raised by my testing department

can any one help me.

i tried this i apply enable =false  the filed is become disable even date picker is not opening if click on text filed .   

Hello Rajesh,

Please check attached image to get it done.

Add Calendar widget with Icon beside it and set Calendar input trigger with that Icon and set input property


onkeypress: "return false;"


Amol Tupe wrote:

Hello Rajesh,

Please check attached image to get it done.

Add Calendar widget with Icon beside it and set Calendar input trigger with that Icon and set input property


onkeypress: "return false;"



Thanks for reply,

working perfect!!


Hi Rajesh,

Use the below javascript to force user to select date from the Date Picker only.


/*JS For Validating Date Input*/
$(document).ready(function(){
  $('.DateInputValid').on("cut copy paste",function(e) {
    e.preventDefault();
  });
});
$(document).on("cut copy paste",".DateInputValid",function(e) {
    e.preventDefault();
  });




function nokeypress(evt,InpId)
{
var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode !=13)
    {
       // $("#ValidationMessage_"+InpId.id).html("Please select date from calendar").show().fadeOut("slow"); 
    return false;
    
    }
    return true;
}

After adding this javascript to module, call this function "return nokeypress(event,"+txtCreatedTo.Id+");"

on "onkeypress" event. Also apply the style class "DateInputValid" to prevent user from cut, copy, paste.


Pravi Gupta wrote:

Hi Rajesh,

Use the below javascript to force user to select date from the Date Picker only.


/*JS For Validating Date Input*/
$(document).ready(function(){
  $('.DateInputValid').on("cut copy paste",function(e) {
    e.preventDefault();
  });
});
$(document).on("cut copy paste",".DateInputValid",function(e) {
    e.preventDefault();
  });




function nokeypress(evt,InpId)
{
var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode !=13)
    {
       // $("#ValidationMessage_"+InpId.id).html("Please select date from calendar").show().fadeOut("slow"); 
    return false;
    
    }
    return true;
}

After adding this javascript to module, call this function "return nokeypress(event,"+txtCreatedTo.Id+");"

on "onkeypress" event. Also apply the style class "DateInputValid" to prevent user from cut, copy, paste.


Thank you.


Solution

Hi Rajesh,

Please mark my answer as a solution.

Thanks

Solution