10

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?

2 Answers 2

5

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.

2
  • Did you ever get a link to this Bug/Known Issue? It doesn't appear to be fixed and workarounds cannot always be applied. I'm finding that the disabled Select isn't being output into the DOM as a Select. Instead, it is being output as a link, styled to look like a disabled select. Therefore, there is nothing usable to be re-enabled.
    – Bigears
    Commented Oct 26, 2016 at 13:26
  • Here's link to known issue, success.salesforce.com/issues_view?id=a1p3A0000001BaTQAU
    – Doug Ayers
    Commented Nov 15, 2016 at 21:43
1

This is a known issue tentatively scheduled to be fixed in Spring '17 release

https://success.salesforce.com/issues_view?id=a1p3A0000001BaTQAU

1
  • 1
    Unbelievable - one full year later and the bug is still there. And from the outside it looks like a small glitch in the rendering and very easy to fix. Feels like force:inputField is not the highest prioritized thing on the roadmap.
    – Uwe Heim
    Commented Dec 17, 2016 at 15:43

You must log in to answer this question.

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