4

Following is my code:

AccountFI.cmp

<aura:component controller="AccountController" implements="force:appHostable">
    <aura:attribute name="account" type="Account" default="{ sobjectType: 'Account' }"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <force:inputField value="{!v.account.Name}"/>
    <force:inputField value="{!v.account.Type}" class="elfForceEditable" />
</aura:component>

AccountFIController.js

({
    doInit: function(component, evt, helper) {
        var action = component.get("c.getAccount");
        action.setCallback(this, function(a) {
                component.set("v.account", a.getReturnValue());
                $('select.elfForceEditable').removeAttr('disabled');
        });
        $A.enqueueAction(action);
    },
})

Apex Controller:

public class AccountController {
     @AuraEnabled
    public static Account getAccount() {
        return [select Id, Name from Account Limit 1];
    }
}

I tried in dev org. I get an

Internal Server Error, WARNING: Action failed: ltng$locker$controller$createComponent aura_proddebug.js:14471 WARNING: Action failed: one$auraContainer$controller$init aura_proddebug.js:14471 WARNING: components.createComponent(): client-side component creation failed aura_proddebug.js:14471 WARNING: Event.setParams(): '0'('') is not a valid parameter. Valid parameters are 'componentDef', 'componentAttributes', 'forceServerDependencies', 'resetHistory', 'ignoreExistingAction'

Do we need to enable something for this component to work? Tried in Developer Pro sandbox as well, and still got the same error. I went through all the posts I could find, and it seems to work for everyone. I can't figure out why it does not work for me.

  • 1
    thank you Adrian!! for editing the post to make it readable. – Tara Mar 1 '16 at 22:58
  • Can you add Type field also to your SOQL and see if it helps – Mohith Shrivastava Mar 2 '16 at 0:07
  • It didn't help adding Type in the SOQL. These are the warnings I received: WARNING: Action failed: ltng$locker$controller$createComponent aura_proddebug.js:14471 WARNING: Action failed: one$auraContainer$controller$init aura_proddebug.js:14471 WARNING: components.createComponent(): client-side component creation failed – Tara Mar 2 '16 at 17:22
  • Is that all code you have .I feel you have some events and thats causing issue..I would like to dig deeper if you could put all code here . – Mohith Shrivastava Mar 2 '16 at 17:31
  • 1
    could you please add the same code on your end and see if it works. when I comment the code for Type( <force:inputField value="{!v.account.Type}" class="elfForceEditable" />) the name(<force:inputField value="{!v.account.Name}"/>) is displayed and the code works. It is not working for picklist. – Tara Mar 2 '16 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.