I need to override standard Create and Edit Actions on Account object with Lightning Component. Is there a way or a type of field that we could cover the following requirement? Have a field with some predifined values but letting user if he wants to enter free text. I would actually like something like Subject field on Task object but i cannot find any way to implement it. Any ideas please ?

Example: I have a picklist field for Citizenship that has some values for Countries (England, Germany, France, ...etc...). But i want to let user enter his own value (for example: German). i have tried using the following but without success:

<!--05/09/2019 George Galaios: Code for Iteration Picklist: Citizenship -->
                        <lightning:select aura:id="accCitizenship" label="{!$Label.c.ea_citizenship}" value="{!v.accountRecord.ea_Citizenship__c}" disabled="{!and(v.noExtraPermission, v.noPermAndCleansed)}" class="slds-size--1-of-2 slds-p-horizontal_x-small">
                            <aura:iteration items="{!v.ea_Citizenship_Values}" var="item">
                                <option value="{!item}" selected="{!item==v.accountRecord.ea_Citizenship__c}">{!item}</option>
                        <!-- End of Code for Iteration -->

You can give last option as "Other" to select value. Once other value is selected you can render input field where a user can enter text value. Before mapping, you need to check if the value is "Other" you need to consider input field.

| improve this answer | |
  • Chetan, thanks for your answer. What you describe is a very good idea, but the requirement was to achieve the functionality in the same field. Thank you anyway :) – Giorgos Galaios Oct 28 '19 at 9:19

Finally i gave solution to my problem by creating a new Lightning Component and including it to the Lightning Component for Account. This component i created has an input field as well as a dropdown list to show the available list items. Onclick, the dropdown gets displayed and onfocusout it gets disappeared. Also, the inputField has an action onchange in order to call Apex Class controller to filter the results while user is Typing!

| improve this answer | |

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.