You need to sign in to do that
Don't have an account?
jd123
How to create Date as input with Calendar in visualforce page???
Hi All,
I want to create a date as input with calendar if I enter date value like today date or tomorrow date this date I need get in apex conroller.
Any help is Appreciated.
Hi,
Try the below code snippet as reference:
-------- Vf page-------------
<apex:page controller="inputdate" >
<script>
function DynamicDatePicker(d_id)
{
DatePicker.pickDate(false,d_id.id,false);
}
</script>
<apex:form >
<apex:inputText id="time" value="{!inputdate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="20" disabled="false" style="width:150px;"/>
<apex:commandButton action="{!testdate}" value="Save" />
</apex:form>
</apex:page>
--------------------- Apex Controller --------------------
public class inputdate
{
public date inputdate{get;set;}
public void testdate()
{
system.debug('@@@@@@@@@@@@@@'+inputdate);
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
Hi,
Try the below code snippet as reference:
-------- Vf page-------------
<apex:page controller="inputdate" >
<script>
function DynamicDatePicker(d_id)
{
DatePicker.pickDate(false,d_id.id,false);
}
</script>
<apex:form >
<apex:inputText id="time" value="{!inputdate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="20" disabled="false" style="width:150px;"/>
<apex:commandButton action="{!testdate}" value="Save" />
</apex:form>
</apex:page>
--------------------- Apex Controller --------------------
public class inputdate
{
public date inputdate{get;set;}
public void testdate()
{
system.debug('@@@@@@@@@@@@@@'+inputdate);
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Great it is working fine.
but i need explanation of onfocus and onchange functions and DatePicker.pickDate(false,d_id.id,false);
<apex:inputText id="time" value="{!inputdate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="20" disabled="false" style="width:150px;"/>
function DynamicDatePicker(d_id)
{
DatePicker.pickDate(false,d_id.id,false);
}
would you please give some explantion.
Thanks navatar. It works good.
How can we disable future dates in date picker ?
Thanks Ankit
Its working.
Have a nice day.
Anil