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
Mthobisi Ndlovu 2Mthobisi Ndlovu 2 

Custom Date Field Not displaying on Visualforce Page

Hi Guys.

I have a custom date field that doesn't display on Vf page when ShowHeader is set to true on VF page. If I set it to false the field works fine. What Could be the issue here? Please see code below. Thanks
<div class="row">
					<div class="col-xs-6">
						<div class="input-group">
							<label for="datePicker" class="control-label col-xs-4">Date</label>
							<div class="col-xs-6">
								<apex:inputText label="Date" styleClass="datePicker" id="date" value="{!myDate}" required="true"/> 
							</div>
						</div>
					</div>
			</div>


//Javascript
function defaultDateVal() {
  j$(".datePicker").val(getDefaultDate());
}
  function selectPreviousTimesheetDatePicker() {
  		 j$( ".datePicker" ).datepicker({
 				changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                dateFormat: 'yy/mm/dd',
             	onClose: function(dateText, inst) {
                    var date = new Date(dateText);
                    getEmployeeTimesheet(date, employeeId);
					getTotalCapturedHours(date, employeeId);
					getTotalCapturedBillableTimesheetHours(date, employeeId);
					getTotalCapturedNonBillableTimesheetHours(date, employeeId);
					populateHoursPerDay(date, employeeId);
					getTotalWorkingHoursPerMonth(date);
                }, 
             	beforeShow: function (input, inst) {            
                	j$(this).datepicker('option', 'defaultDate', new Date());
                }
     		 	});
      	
  }

 
Best Answer chosen by Mthobisi Ndlovu 2
Mthobisi Ndlovu 2Mthobisi Ndlovu 2
Hi Sunil

Sorry man, The issue was actually with my input styleClass "datePicker" I discovered that Salesforce actually uses the same class as I was. So the salesforce standard CSS was overriding mine, all I had to do was to change the styleClass.

but yes, your code actually works.