You need to sign in to do that
Don't have an account?
Gopinath418
how to display error message under a picklist in custom lightning component
I have a lightning component in which all the input fields of an custom object are being shown.
I have to fill all the inputs and submit it.
I have a picklist field and i am showing it in the component as below
<force:inputField aura:id="tc" value="{!v.obj.picklist_field__c}"/>
how could i set the picklist as required by using above syntax? and i wanted to display error message if you not fill the picklist field.
it's urgent..pls
Thanks,
Gopi
I have to fill all the inputs and submit it.
I have a picklist field and i am showing it in the component as below
<force:inputField aura:id="tc" value="{!v.obj.picklist_field__c}"/>
how could i set the picklist as required by using above syntax? and i wanted to display error message if you not fill the picklist field.
it's urgent..pls
Thanks,
Gopi
You can use syntax like below I used for validating. You need to write the code into Controller.
Let me know if this helps :)
Thanks,
Amit Singh
Your code is working for Text,Number input fields.
It is not working for Picklist field.
I want to dispaly error message for Picklist field.
Thanks,
Gopi
I am not sure if you have tried this or not but below is working code for me.
-- Component -- -- Controller Method --
Let me know the outcomes.
Thanks,
Amit Singh
By using <ui:inputSelect /> component to am able to display error message for a picklist field.But
I am using <force:inputField /> component to display picklist field and have to display error message on that <force:inputField /> used picklist field.
Thanks,
Gopi
Also use can use required attribute of this tag.
Visit below link.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_force_inputField.htm
Thanks,
Amit Singh
if a picklist has two values A and B
if you use force:inputField with out required true then the pick list is appearing with "--none--"
if you use force:inputField with required true then the pick list is appearing with "A"
bydefault my picklist shoud not have any values (it should display "--none--" as default value ).
Thanks,
Gopi