1

I have a list name companyList iterating to show list of user in table.Every row has company name and a radio button to select company id . Here Problem is how I can bind a radio button for a row with respective company id show that user can choose only one company id from table as I do have list value to bind with radio.

=Company Name=|=Company ID====

ABC           | radio with company ID 1
XYZ           | radio with company ID 2
<display:table uid="companyConfig" name="dataExchangeCompanyList" htmlId="companyListTable" requestURI="ncrDatapackageExport!ajax" ajax="true">
    <!-- Company Name -->
    <display:column titleKey="tdp.export.company.name" class="company-column textLeft" sortable="true" sortProperty="company">
        <s:property value="#attr.companyConfig.company"/>
    </display:column>
    <!-- Check Box  -->

    <display:column titleKey="tdp.export.select" class="textCentre" media="html">
        <s:radio name="selectedCompanies" value="%{#attr.companyConfig.id}" />
    </display:column>

</display:table>

Here I am using display table to iterate over list

Roman C
  • 49,761
  • 33
  • 66
  • 176
Vivek Panday
  • 1,426
  • 2
  • 16
  • 34

1 Answers1

0

Bind the control by name. You should specify the index for the property where selected values would be stored when you submit the form.

<display:column titleKey="tdp.export.select" class="textCentre" media="html">
  <s:radio name="selectedCompanies[%{#attr.companyConfig_rowNum - 1}]" value="%{#attr.companyConfig.id}" />
</display:column>
Roman C
  • 49,761
  • 33
  • 66
  • 176