You need to sign in to do that
Don't have an account?
Sai Subhash 6
I tried this
Component:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction">
<fieldset class="slds-form-element">
<div class="slds-form-element__control">
<div class="slds-radio_button-group">
<legend class="slds-form-element__legend slds-form-element__label">Please Rate Technician</legend><br/>
<ui:inputRadio text="1" label="1" name="Role" change="{!c.onGroup}"/>
<ui:inputRadio text="2" label="2" name="Role" change="{!c.onGroup}"/>
<ui:inputRadio text="3" label="3" name="Role" change="{!c.onGroup}"/>
<ui:inputRadio text="4" label="4" name="Role" change="{!c.onGroup}"/>
<ui:inputRadio text="5" label="5" name="Role" change="{!c.onGroup}"/>
</div>
</div>
</fieldset>
</aura:component>
Controller:
({
onGroup: function(cmp, evt) {
var selected = evt.getSource().get("v.text");
//alert(selected);
}
})
How can i save a selected radio button value into field using Lightning component
I tried this
Component:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction">
<fieldset class="slds-form-element">
<div class="slds-form-element__control">
<div class="slds-radio_button-group">
<legend class="slds-form-element__legend slds-form-element__label">Please Rate Technician</legend><br/>
<ui:inputRadio text="1" label="1" name="Role" change="{!c.onGroup}"/>
<ui:inputRadio text="2" label="2" name="Role" change="{!c.onGroup}"/>
<ui:inputRadio text="3" label="3" name="Role" change="{!c.onGroup}"/>
<ui:inputRadio text="4" label="4" name="Role" change="{!c.onGroup}"/>
<ui:inputRadio text="5" label="5" name="Role" change="{!c.onGroup}"/>
</div>
</div>
</fieldset>
</aura:component>
Controller:
({
onGroup: function(cmp, evt) {
var selected = evt.getSource().get("v.text");
//alert(selected);
}
})
@Sai Subhash 6
I am not sure if you are looking for this.
We can update a field in two ways
1. using an attribute
In component
In Js Controller
2 using aura:id
In Component Part of aura bundle
In JS controller
Please mark this as best answer if your query has been resolved. Visit my blog to find more about lightning https://techevangel.com/author/anilsomasundaran/