2

I have <ui:inputDate> field for which I set the placeholder via JS, like so:

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 dt=component.find('inputDate');
        dt.set('v.placeholder','[enter due date here]');
    }
})

In a Locker-Service enabled enviroment, this works if you place the component in community template as root component.

But if you place this in another component as sub-component (nested component), it gives out an error that says:

This page has an error. You might just need to refresh it.
Access Check Failed! AttributeSet.set(): 'placeholder' of component 'markup://ui:inputDate {383:2;a} {inputDate}' is not visible to 'markup://c:INPUTDATE {381:2;a}'.
Failing descriptor: {markup://c:INPUTDATE}

Any idea?

  • Do you happen to have any other element with aura:id inputDate may be in parent component? Or just try to change the aura:id to something else, inputDate being a reserved keyword. – Santanu Halder Apr 7 '17 at 10:43
  • thanks for the comment, and tried your suggestion. though it made no difference. – pnoytechie Apr 7 '17 at 10:55
  • there is no attribute like placholder in ui:inputdate component. refer this link developer.salesforce.com/docs/atlas.en-us.lightning.meta/… – vignesh Apr 7 '17 at 11:02
  • @vignesh, yes i know. it more of a workaround. but why the first one works in the first place? – pnoytechie Apr 7 '17 at 11:10
  • I tried your code. Its not working when used as nested component, however I am not getting any error messages. – Santanu Halder Apr 7 '17 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.