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
ckumckum 

unable to retrieve the value from radio button selection

Hi,

 

I am stuck with a major issue with Radio Button. It is very urgent. Kindly reply ASAP.

 

<input type="radio" name="{!QR.rowNumber}" value="{!QR.chkStatus}" />   -------> This is my Radio Button in VF page.

 

In my functionality there is a '+' sign. If I click on this, it adds a new Row which includes Radio Button Option , Quantity and Sales Price. Assume there are 5 rows added, and I checked radio buttion option in Row 2. Now I want the List which is returning the values should return the 2nd Row Radio Button Value as 'true' and other should be 'false'. But it is always returning false for every row.

 

class quantityRow

{

public Boolean selectedCharge;

 

 

public Boolean getselectedRecordId1()

{

System.debug('***************selectedCharge '+this.selectedCharge);

return this.selectedCharge;

}

public void setselectedRecordId1(Boolean s)

{

 

public decimal salesprice

{ get;set; }

 

public Boolean chkStatus

{ get;set; }

public decimal quantity

{ get;set; }

 

public string rowNumber

{ get;set; }

 

 

public quantityRow(Integer count)

{

rowNumber = string.valueOf(count);

}

 

}

 

chkStatus is the Radio Button value.

 

List  details: List lstOP is returning all the results in quantityRow and oppProduct........

public list<oppProduct> getOppProducts()

{

return lstOP;

}

 

class oppProduct

{

public string productId

{ get;set; }

 

public String hidProductId

{ get; set; }

 

 

public list<quantityRow> lstQR = new list<quantityRow>();

 

 

 

public list<quantityRow> getLSTQR()

{

return lstQR;

}

 

public Integer QRSubCounter

{ get;set; }

 

public oppProduct(Integer qrCount)

{

QRSubCounter = qrCount;

quantityRow qr = new quantityRow(QRSubCounter);

lstQR.add(qr);

}

 

public void addQR()

{

quantityRow qr = new quantityRow(QRSubCounter);

lstQR.add(qr);

}

 

public void removeQR()

{

lstQR.remove(lstQR.size() - 1);

}

 

}

 

 

Other issue is: when I select 1 value from radio button option and then press  '+' sign for adding new row then the selected value of the radio button disappears. I want that the selected value should remain as it is.

 

<td align="right" width="25%">

<apex:commandButton value="+" action="{!op.addQR}" rerender="opQR"/>

</td>

 

 

public void addQR()

{

quantityRow qr = new quantityRow(QRSubCounter);

lstQR.add(qr);

}

 

Kindly help!!!!!!!!!!!!

 

Thanks and Regards,

 

ckum