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
vikramkkvikramkk 

Datepicker in Visualforce page

http://boards.developerforce.com/t5/Visualforce-Development/Datepicker-in-Visualforce-page/m-p/425965#M49008

 

Regarding this post

 

I tried option 2 with <apex:inputtext> inside <apex:column> in pageblocktable. But I didn't calendar popup. Do I need to make any change to make it work?

 

Thanks

Vikram

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below code snippet as reference

=====vf======

 

<apex:page controller="DatePickerDEmo" id="myPage">

<apex:form id="myForm">

<script>

                       function DynamicDatePicker(d_id)

                       {

                       

                         DatePicker.pickDate(false,d_id.id,false);

                       }

</script>

    <apex:pageBlock title="My Content" id="pb1">

 

        <apex:pageBlockTable value="{!Con}" var="item">

 

           <apex:column >

           Date&nbsp;&nbsp;<apex:inputText value="{!d_date_str}" id="t" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="20" disabled="false" style="width:150px;"/>

           </apex:column>

           <apex:column value="{!item.name}"/>

 

        </apex:pageBlockTable>

 

    </apex:pageBlock>

</apex:form>

</apex:page>

 

=========Apex Controller======

 

public class DatePickerDEmo {

 

    public String d_date_str { get; set; }

 

    public List<Contact> Con { get; set; }

 

    public DatePickerDEmo()

    {

        Con =new List<Contact>();

        con=[select name from Contact Limit 10];

    }

 

 

 

 

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.