1

Hi I am new to Lightning and working on radio buttons. However I am unable to find any documentation on how to toggle between the two buttons. My requirement is that either of the buttons needs to be selected.

<div class="slds-tabs__content slds-show" role="tabpanel">
<div class="slds-media">
<div class="slds-media__body tab-top-panel">
<div class="slds-grid slds-grid--align-space">
<div class="slds-col slds-size--1-of-1">
<div class="top-panel-button-wraper">
<a class="slds-button slds-button--brand top-panel-button flat-blue" >
<div class="uiInput uiInputRadio uiInput--default uiInput--radio">
   <label class="uiLabel-left form-element__label uiLabel" for="globalId"><span>Driver REport</span></label>
   <input type="radio" id="globalId">
   </input>
</div>
<div class="uiInput uiInputRadio uiInput--default uiInput--radio">
   <label class="uiLabel-left form-element__label uiLabel" for="globalId"><span>Volume Report</span></label>
   <input type="radio" id="globalId">
   </input>
</div>
2

Hitesh's Answer is correct.
You need to provide the same name for all radio buttons.

If you want to preselect a radio input,
you have to provide checked="" or checked="checked"

See https://jsfiddle.net/dLvu9av6/ for clarification

1

For Radio button you need to Simply give them the same name.

<input type="radio" id="globalId" name="reportRadio">
2
  • I was asking about how to set default to one radio button and toggle when the other is selected . Any insight into that? – Vanilla_Sky May 2 '16 at 12:36
  • then use <input type="radio" id="globalId" name="reportRadio"{!IF((condition),'checked="checked"', '')} /> – Hitesh Gupta May 2 '16 at 14:22

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.