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
Shruti VishShruti Vish 

want to use place holder for for date picker

I want to use place holder for date picker me using ui:inputdate
Pranav ChitransPranav Chitrans
Hi Shradga,

You can simply use the attribute like HTML "Placeholder" with some little change on apex page html-placeholder="dd-mm-yyyy".
For better html view you should use the docType="html-5.0" on apex page atrribute
<apex:page standardController="ClassName" docType="html-5.0" extensions="IFAny" sidebar="false" showHeader="false" standardStylesheets="false"> 
 <html>
	<apex:form>
		<apex:inputfield value="{!obj.objTimeLogWrapper.Date__c}" type="date"  id="IDDate" html-placeholder="dd-mm-yyyy" style="width:140px" />
	</apex:form>
 </html>
 </apex:page>
Hope this help!

 
Shruti VishShruti Vish
But I want to use in lightning
Pranav ChitransPranav Chitrans
Hi Shradha,

Then You can try something like this <ui:inputText placeholder="dd-mm-yyyy"> or whatever the type you ant to keep
few more example : <ui:inputEmail aura:id="email" label="Email" placeholder="abc@email.com"/>
Shruti VishShruti Vish
For UI:inputdate there is no placeholder attribute
Pranav ChitransPranav Chitrans
Hi Shradha,
INPUTDATE.cmp:
<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
    <ui:inputDate aura:id="inputDate" displayDatePicker="true" />
    <ui:button press="{!c.setPlaceholder}" label="Set placeholder" />
</aura:component>
JS CONTROLLER:
({
    setPlaceholder : function(component, event, helper) {
        var dtPlchldr=component.find('inputDate');
        dtPlchldr.set('v.placeholder','[enter due date here]');
    }
})

Try Something like this, becuase there is no attribute like placholder in ui:inputdate component
Shruti VishShruti Vish
Hi Pranav ,

I tried the above code but its not working.But my requirement is how we normally use place holder for ui:inputText i want to use like that same
Akshay_DhimanAkshay_Dhiman
Hi Shradha,
You can use an input field for entering a date because there is no place holder in ui:inputDate. So to enter date in exact format you can use input field.The date format is automatically validated during the onblur event.
<lightning:input type="date" label="Birthday" name="date" />
Source Link:
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_input.htm
Hope this will help you.

Regards,
Akshay