+ Start a Discussion
Kalaivani KKalaivani K 

I need to show text box based on the value selected in the drop down menu in salesforce lighting

I need to show text box in the opportunity object for various stages based on the value selected in the drop down menu in salesforce lighting. Please help me on this!!!!
Best Answer chosen by Kalaivani K
Meghna Vijay 7Meghna Vijay 7
Hi Kalaivani,
 
<aura:component>
 <aura:attribute name="isSelected" type="Boolean" />
<aura:attribute name="selectedVal" type="String" />
 <lightning:select value="{!v.selectedVal}"onclick="{!c.showTextbox}"> // Use lightning select with the required attribute
</lightning:select>
<aura:if isTrue="{!isSelected}">
 <!---  your input textbox-->
</aura:if>
</aura:component>

/*** Controller.js **/

showTextbox : function(component) {
  if(component.get(v.selectedVal) == 'blah') {
     component.set('isSelected', true);
}
}

Hope it helps, if it does mark it as solved.

Thanks

All Answers

Meghna Vijay 7Meghna Vijay 7
Hi Kalaivani,
 
<aura:component>
 <aura:attribute name="isSelected" type="Boolean" />
<aura:attribute name="selectedVal" type="String" />
 <lightning:select value="{!v.selectedVal}"onclick="{!c.showTextbox}"> // Use lightning select with the required attribute
</lightning:select>
<aura:if isTrue="{!isSelected}">
 <!---  your input textbox-->
</aura:if>
</aura:component>

/*** Controller.js **/

showTextbox : function(component) {
  if(component.get(v.selectedVal) == 'blah') {
     component.set('isSelected', true);
}
}

Hope it helps, if it does mark it as solved.

Thanks
This was selected as the best answer
Kalaivani KKalaivani K
Hi  Meghna Thank your for your Reply.
Its working now..

 
Meghna Vijay 7Meghna Vijay 7
Hi Kalaivani,

Please mark it as solved to help others too.

Thanks