function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Qiuyan LIUQiuyan LIU 

force:inputField doesn't work

Hello, I am trying to use "force:inputField" to create type-specific input component implementation based on the data type to Create Account Record. 

Here is what I did : 

In cmp file : 

<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:attribute name="account" type="Account" default="{ sobjectType: 'Account' }"/>
 <force:inputField value="{!v.account.Name}" />

In Controller :
doInit: function(component, evt, helper) {
         var action = component.get("c.getAccount");
        action.setCallback(this, function(a) {
            console.log(a.getReturnValue());
                component.set("v.account", a.getReturnValue());
            
        });
        $A.enqueueAction(action);
    },

I can see the v.account value if I use ui:inputText, so it is not the problem of javascript or apex code. I did not got any error,  only a blank page with nothing in html markup, the javascript function is not event executed. 

Please help me ! Thanks a lot 
isalewisalew
I'm having the same issue too. I look forward to hearing a solution!
ChicloudChicloud
Is it possible that you are viewing this component within a VF Page in SFDC Classic?  I don't believe you can use force:inputField at all within classic if I'm not mistaken..  Unfortunately. there is no ui:inputField.. hmmm .waiting SFDC..  you're forced to roll your own solution.
 
mkaufmanmkaufman
<force:inputField> is not working for me either, both in a lightning UI page and in a harness app.
isalewisalew
I just finished a multi-month marathon with Salesforce R&D on the issue of <force:inputField> components not working. Here is the solution/workaround we achieved:
http://salesforce.stackexchange.com/questions/119455/lightning-component-initialization-after-redirect/131610#131610