+ Start a Discussion
Hope E.Hope E. 

Passing values of repeated check boxes from VF page to controller

Hi,

I have couple of questions in my VF page.
A has 3 checkboxes (A,B,C)
B has 3 checkboxes (A,B,C)
I've created a wrapper class with the question's Id, checkbox name and the isSelected Boolean. But it only passes the values of the last Item to controller.

Do you have any idea why it's not working?

Thx in advance!
Best Answer chosen by Hope E.
Hope E.Hope E.
I've added a new wrapper class containing the question+the list of checkboxes. the problem is resolved now!

All Answers

Ruwantha  LankathilakaRuwantha Lankathilaka
Post your code
Mukesh_SfdcDevMukesh_SfdcDev
Hi Hope,

Use Param and action support to get all values.Please provide your code snippet so that we can identify the exact solution of your code

Thanks
Mukesh Kumar
 
Hope E.Hope E.
Hi,

thx for reply!

it's something like this. first I create a map and fill it with values. the visualforce page result are Ok!
But when I want to save the map, only the last Item in the list contains the correct information.
Controller:
public Map<Id, List<AM_DayWrapper>>  AM_Map	{get; set;}
public class AM_DayWrapper{
        public Id      qlistId 			{get; set;}
        public String  dayName			{get;set;}
        public Boolean isSelected 		{get;set;}
        
        public AM_DayWrapper(){}
}


VF Page: first I have a repeated list of my questions and then:
<apex:repeat value="{!checkListQustionsMap[key]}" var="keyQ">
<...>    
<apex:outputPanel layout="none">
	<table id="tb">		
		<tr>
		   <td>AM</td> 
			<apex:repeat value="{!AM_Map[keyQ]}" var="day_AM"> 
				<td>
					<apex:inputCheckbox value="{!day_AM.isSelected}"/>
				</td> 
			</apex:repeat>
		</tr>   
	</table>                                            
</apex:outputPanel>
<...>


 
Hope E.Hope E.
I've added a new wrapper class containing the question+the list of checkboxes. the problem is resolved now!
This was selected as the best answer