3

Using a <force:inputField value="{!v.account.ParentId}" /> seems to have flaws running in a Lightning Community

enter image description here

Issues

  • Rendering: wrong/missing styles
  • Link "Find more results" does not work
  • After selection and save, it won't save. However the other values in the from DO save.

Compo

<aura:component controller="elfL1" implements="forceCommunity:availableForAllPageTypes,force:appHostable">
    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
        <aura:attribute name="account" type="Account" default="{ sobjectType: 'Account' }" />
    <form class="elfForm">
        <force:inputField value="{!v.account.ParentId}"  class=""  />
        <ui:button class="form-control" aura:id="button" label="Save" press="{!c.save}"/>
    </form>
</aura:component>               

js

init : function(component, event, helper) {
    var action2 = component.get("c.getAccount");        
    action2.setCallback(this, function(response) {
        console.log(response.getReturnValue());
        component.set("v.account", response.getReturnValue());
    });
    $A.enqueueAction(action2);
}, 
save : function(component, event, helper) {
    var action = component.get("c.saveAccount");
    var account = component.get("v.account");
    action.setParams({"account": account});
    action.setCallback(this, function() {  
    } );
    $A.enqueueAction(action);
},

apex

    @AuraEnabled public static Account          getAccount(){
        return (Account) Database.query( ' SELECT Name,Type,Rating,ParentId FROM Account LIMIT 1 ' )[0];
    }
    @AuraEnabled public static Account          saveAccount(Account account){
        upsert account;
        return account;
    }
}
  • same here for me as well, did you ever happen to find correct CSS styling according to Lightning Design system for this field? – VarunC Nov 15 '15 at 13:00
  • @ Uwe Heim, any update on this ? – apn Jan 4 '17 at 15:23
  • @ Uwe Heim, any update on this ? – apn Jan 4 '17 at 15:23
  • @apn yes, it looks way better now, however I can not say how good it really is, because I had no time for deep testing. So you should replicate this example and I would recommend to do so on a prerelease Org with Spring 17 – Uwe Heim Jan 4 '17 at 21:14

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.