function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vamsi krishna 106vamsi krishna 106 

How to disable the future dates from <apex:input type="date"/>

Hi Guys,
<apex:input type="date" value={!somevalue}/>

in the above situation how can i disable the future dates in that date puicker..please help me....thanks in advance..
anto nirmalanto nirmal
Hi Vamsi,

The solution for this depends on the the complete page.
If this is a Standard controller, then just adding a validation rule on the Object will suffice.
Something like the below:
CloseDate  >  TODAY()
Let me know if this helps.

As a common practice, if your question is answered, please choose 1 best answer.
Additionally you can give every answer a like if that answer is helpful to you.

Regards,
Anto Nirmal


 
vamsi krishna 106vamsi krishna 106
Hey anto nirmal why we need go for the validation rule..i tried with jquery..and finally i got solution..
 
$(function(){
        var now = new Date();
        var day = ("0" + now.getDate()).slice(-2);
        var month = ("0" + (now.getMonth() + 1)).slice(-2);
        var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
        $("[id$='forfuturedatesdisable']").attr('max', today);
        $("[id$='pastdatesdisable']").attr('min',today);
       
        });

<apex:input type="date" id="forfuturedatesdisable"/>
<apex:input type="date" id="pastdatesdisable"/>

i hope it will use to others..