1

A ui:inputSelect component is generating this javascript warning in the browser console when I invoke the change event. I get the warning multiple times once for each item in the list.

WARNING: AttributeSet.set(): unable to override the value for 'value=function (cmp, fn) { return fn.empty(cmp.get("v.exhibitPublicName")); }'. FunctionCallValues declared in markup are constant.

Here is the code for the input:

<ui:inputSelect class="slds-select" label="Exhibition:" labelClass="slds-form-element__label" aura:id="exhibits" change="{!c.exhibitChange}" >
    <ui:inputSelectOption text="" label="All Exhibits" value="{!empty(v.exhibitPublicName)}"/>
    <aura:iteration items="{!v.exhibits}" var="exhibit">
        <ui:inputSelectOption text="{!exhibit.Public_Exhibit_Name__c}" label="{!exhibit.Public_Exhibit_Name__c}"  value="{! v.exhibitPublicName == exhibit.Public_Exhibit_Name__c}"/>
    </aura:iteration>
</ui:inputSelect>

The handler does't even have anything in it:

exhibitChange:function(component, event, helper) {

}

Any ideas on what is causing the warning. I am just trying to fill the dropdown, and set the selected value if it matches an attribute.

Thanks!

  • 1
    To invoke a controller action, you need to have expression statement :{!c.methodName} format.So change attribute should be equal to {!c.exhibitChange} instead of c.exhibitChange. – Praveen Sep 16 '16 at 18:42
  • Thanks for the hint @Praveen The code is working. It was actually working before I put the event handler into the expression syntax. I am still getting the warning. Any other ideas? I am getting the warning multiple times once for each item in the list. – Chris Mullins Sep 16 '16 at 19:05
  • does the <aura:attribute name="exhibitPublicName"/> have access attribute specified?if not set the access to public like this : <aura:attribute name="exhibitPublicName" access="public"/> – Praveen Sep 16 '16 at 19:11
  • The access was not specified, I did try to change it to public as you suggested but the warning is still there. Thanks so much for your help. – Chris Mullins Sep 16 '16 at 19:46
  • 1
    Not sure what is wrong here.Can you try removing this line : value="{! v.exhibitPublicName == exhibit.Public_Exhibit_Name__c}" in the ui:inputSelectOption and have an value attribute for the ui:inputSelect:<ui:inputSelect value="{!v.exhibitPublicName}"/> – Praveen Sep 16 '16 at 20:00
2

To invoke a controller action, you need to have expression statement :{!c.methodName} format.So change attribute should be equal to {!c.exhibitChange}instead of c.exhibitChange.

Also remove this line : value="{! v.exhibitPublicName == exhibit.Public_Exhibit_Name__c}" from ui:inputSelectOption and have an value attribute for the ui:inputSelect:<ui:inputSelect value="{!v.exhibitPublicName}"/>

Like this:

<ui:inputSelect value="{!v.exhibitPublicName}" class="slds-select" label="Exhibition:" labelClass="slds-form-element__label" aura:id="exhibits" change="{!c.exhibitChange}" >
    <ui:inputSelectOption text="" label="All Exhibits" />
    <aura:iteration items="{!v.exhibits}" var="exhibit">
        <ui:inputSelectOption text="{!exhibit.Public_Exhibit_Name__c}" label="{!exhibit.Public_Exhibit_Name__c}" />
    </aura:iteration>
</ui:inputSelect>
  • Just a follow up to using this ui:inputSelect sucessfully. I ended up not binding the value declaratively at all. The problem I ended up having is that the inital value would never set correctly if I wanted to default the parameter, or pass in via a query string. So I would recommend not using the value attribute declaritively at all, and just set in your init code like component.find("exhibitSelect").set("v.value", component.get("v.exhibitPublicName")); – Chris Mullins Sep 19 '16 at 18:37

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.