[SalesForce] Lightning Components: why force:inputField picklist select renders disabled

I originally came across this issue when reviewing the response to this question. There is also a similar question for lookup inputs.

The force:inputField component is really useful for making an input form based on sObject type. However, when using a picklist or multipicklist field type it renders as disabled by default.

Here is a sample component that demonstrates this.

<aura:component implements="force:appHostable">

  <aura:attribute name="task" type="Task" default="{ sobjectType: 'Task' }"/>

  <force:inputField value="{!v.task.Priority}" />

</aura:component>

One hack I found to enable it again is to remove the disabled attribute in the renderer.

render : function(cmp, helper) {
    var element = this.superRender();
    element[0].children[0].removeAttribute('disabled');
    return element;
}

You could also leverage jQuery as shown here.

Is there a better way to enable this input?

Best Answer

I'm in contact with premier support from salesforce. On the phone they confirmed it as a bug and told me about a fix scheduled for Spring'16 (safeharbor).

In the meantime they encouraged me using one of the mentioned workarounds.

It would be very helpful if we had a public list of things which aren't fully functional and known bugs. In this case (and others) I was digging days in the dark, figured workarounds and burned also time of the support.

Related Topic