3

In Visualforce I loved it not to think about types of input-fields and go instead totally blind with an <apex:inputField ... /> letting the platform bother if a field is a textfield, checkbox, picklist or whatever. Workarounds to enforce different types where also possible in VF for the rare occasions where it was necessary.

In the lightning documentation and in the examples I read now, that the input type is expressed explicitly, no longer implicitly, like so

<ui:inputText ... />
<ui:inputNumber ... />
<ui:inputDateTime ... />

Is there a way to get dynamically the best-matched input type as in VF? If not, are there any plan to add this in the future?

3

Maybe.

Reading this article Lightning - How to use force:inputField?, it should be exactly what we need. The basic syntax is

 <force:inputField value="{!v.account.Name}" /> 

The documentation is here: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_force_inputField.htm

An abstract component that provides a concrete type-specific input component implementation based on the data to which it is bound.

But it seems to fall short in documentation and examples plus it behaves very buggy during my tests. See details in the link above.

  • It's still sub-par (unusable actually) – Caspar Harmer Jun 28 '16 at 4:14
  • Now 2 years later, I still can confirm lots of issues with force:inputField. It would be great, if Salesforce could bump the effort to improve it and get it par with apex:inputField soon – Uwe Heim Aug 19 '17 at 10:00

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.