I have a lightning component which acts as a text area field. The mark up is as given below.
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">
<aura:attribute name="Label" type="String" />
<aura:attribute name="fID" type="String" />
<div class="slds-form-element">
<label class="slds-form-element__label" for="{!v.itemID}">{!v.Label}</label>
<textarea id="{!v.fID}" class="slds-textarea" rows="3" />
</div>
</aura:component>
I am using this component in a parent form component. On click of a button from there I am fetching the values from inside all such child components which act as different field types using document.getElementById().value
. It works for all <input>
type tags but returns the value as undefined for the <textarea>
tag.
Any suggestions regarding tackling such a scenario?
document.getElementById(yourIdHere)
null? Can you show the script demonstrating where you are passing the id to the getElement method?<div> <label> <textarea id="someID"> </div>
What I found is that the issue was locker service. It started working as soon as i deactivated it.