function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShivaniShivani 

Radio button select record to process

Hi,

 

I have custom VFPage with search functionality,with search button new section is displayed with Radio button to further process record, i want to get particular record based on radio button selection?

 I have used javascript:

<script type="text/javascript">
           var getRadioId = document.getElementsByName('{!$Component.theRad}');
             alert(getRadioId);
             for(i=0; i<getRadioId.length; i++) 
                
               if(getRadioId[i].checked) {

            alert(getRadioId[i].value);
               }

</script>

 

but not any luck. please have a look.

IspitaIspita

Are you sure you are accessing the radio element in correct order?

Because if the radio button is nested in other elements all those nestings need to be mention in the following call:-

  var getRadioId = document.getElementsByName('{!$Component.theRad}'); 

 

 


ShivaniShivani

yes, In page i used:

 

<apex:column style="width:5%;text-align:center">
            <apex:facet name="header">Action</apex:facet>
            <input type="radio" name="selection" checked="{!wrap.isSelected}" id="theRad"/>
       </apex:column>