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
raj123raj123 

remove default date value from date input field on visual force page

i am getting a default  todays date when the page loads in the inputfield for date, how can i remove this 

 

  <apex:outputLabel value="To:" />

<apex:inputField value="{!EndRecDate.Message_Posted__c}" id="dateorg3" onchange="populateHiddenFields()"/>

Navatar_DbSupNavatar_DbSup

Hi,

 

You can remove the value from your input field by using the JavaScript

For Example

<script>

Docuement.getElementbyId(‘compoenentid’).value=’’;

</script>

 

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

raj123raj123

i am not able to remov, the default value , actually i am doing the following

 

apex:pageblocksectionItem id="pgsecItm2">
                <apex:outputLabel value="To:" /><apex:inputField value="{!EndRange.Date}" id="dateorg2" onchange="populateHiddenFields()"/>
            </apex:pageblocksectionItem>

 

<script>

function populateHiddenFields()
        {
            document.getElementById('{!$Component.pg:frm:pgBlk:dateHdn}').value=document.getElementById('{!$Component.pg:frm:pgBlk:pgsec:pgsecIt:dateorg}').value; if i do.value='' ; the value is not getting populated.
           
        }

<script>

 

 <apex:inputHidden id="dateHdn" value="{!strStartShipDate}"/>

 

can you please help me with this

Starz26Starz26

Do you have a default value set in the definition of the date field on the object it is associated with?

 

If so, remove that.

 

 

 

raj123raj123

@Starz 

 

I dont have any default value on the field set. 

Starz26Starz26

its getting its value from somewhere as the date does not just magically appear by putting the field there...