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!

8
  • 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, 2016 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. Sep 16, 2016 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, 2016 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. Sep 16, 2016 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, 2016 at 20:00

1 Answer 1

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>
1
  • 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")); Sep 19, 2016 at 18:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .