2

I'm getting an error with my custom lightning component. Seems like a common issue and can't seem to figure it out. I'm trying to populate 2 picklists based on different fields in Cases. I'm getting the following error in my Javascript:

WARNING: Access Check Failed! AttributeSet.get(): attribute 'options2' of component 'markup://ui:inputSelect {70:2;a} {reason}' is not visible to 'markup://c:CreateCaseV3 {3:2;a}'.
aura_proddebug.js:16507 

WARNING: Access Check Failed! AttributeSet.set(): 'options2' of component 'markup://ui:inputSelect {70:2;a} {reason}' is not visible to 'markup://c:CreateCaseV3 {3:2;a}'.

Component

<aura:attribute name="cases" type="Case[]"/>
<aura:attribute name="options" type="String[]"/>
<aura:attribute  name="options2" type="String[]"/>

<aura:attribute name="newCase" type="Case"
    default="{ 'sobjectType': 'Case', 
   'Subject': '',
   'Activity__c': '',
   'Reason': '',
   'Contact': '',
   'Description': '',
   'Origin' : '',
   'FOA__c' : '',
   'Project__c' : ''
   }"/>

   <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>

    Case Details <br/>

    <form class="slds-form--stacked">
      <div class="slds-form-element slds-is-required">

        <!-- Activity Field -->

         <div class="slds-form-element__control">    
            <ui:inputSelect aura:id="activity" label="Activity"
                class="slds-input"
                labelClass="slds-form-element__label"
                value="{!v.newCase.Activity__c}"
                required="true"/>
        </div>

        <!-- Reason -->

        <div class="slds-form-element__control">    
            <ui:inputSelect aura:id="reason" label="Reason"
                class="slds-input"
                labelClass="slds-form-element__label"
                value="{!v.newCase.Reason}"
                required="true"/>
        </div>

Init function on the Controller

doInit: function(component, event, helper) {

    // Populate the picklist for Activity // 

    var populateactivities = component.get("c.getActivities");
    var inputsel = component.find("activity");
    var options = [];     

    options.push({"class" : "optionClass", label: "--None--", value: ""});

    populateactivities.setCallback(this, function(a) {
        for(var i=0;i< a.getReturnValue().length;i++){
            options.push({"class": "optionClass", label: a.getReturnValue()[i], value: a.getReturnValue()[i]});
        }
        inputsel.set("v.options", options);

    });

    console.log(options)

    // Send action off to be executed
    $A.enqueueAction(populateactivities);

    // Populate the picklist for Reasons
    var populatereasons = component.get("c.getReasons");
    var inputsel2 = component.find("reason");
    var options2 = [];     

    options2.push({"class" : "optionClass", label: "--None--", value: ""});

    populatereasons.setCallback(this, function(a) {
        for(var i=0;i< a.getReturnValue().length;i++){
            options2.push({"class": "optionClass", label: a.getReturnValue()[i], value: a.getReturnValue()[i]});
        }   

        inputsel2.set("v.options2", options2);

    });

    console.log(options2);

    // Send action off to be executed
    $A.enqueueAction(populatereasons);
  • This is locker-service. It won't allow you to make such change. Follow standard way if it could feasible to achieve. – Ashwani Oct 14 '16 at 7:32
  • 2
    There is no attribute called options2 available in <ui:inputSelect />. So try replacing inputsel2.set("v.options2", options2); to inputsel2.set("v.options", options2);. Also there's nothing to do with locker-service here. – Praveen Oct 14 '16 at 8:02
1

There is no attribute called options2 available in <ui:inputSelect />.

So replacing inputsel2.set("v.options2", options2); to inputsel2.set("v.options", options2); would solve the issue.

For more info about ui:inputSelect can be found here.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.