You need to sign in to do that
Don't have an account?
how to read values from checkbox
hey, when i click the checkbox(list of checkboxes) i want to read the corresponding filed value.
here is my code:
<apex:outputpanel >
<table>
<apex:repeat value="{!parentlist}" var="p1">
<tr>
<td>
<h1><b> {!p1.statusName} </b></h1>
<apex:param name="statusopname" assignTo="{!newstatusname}" value="{!p1.statusName}"/>
</td>
</tr>
<tr><td>
<h5> <b> Next Status Option</b> </h5>
</td></tr>
<apex:repeat value="{!p1.statussubmenu}" var="p12" >
<td colspan='2'>
<apex:inputcheckbox value="{!p12.chklist}">{!p12.submenu}
<apex:param name="nextstatuschkbox" assignTo="{!chkbox}" value="{!p12.chklist}"/>
<apex:param name="nextstatusop" assignTo="{!nextstatus}" value="{!p12.submenu}"/>
<apex:actionSupport event="onclick" action="{!updatestatusoption}" rerender="statusdialog"/>
</apex:inputcheckbox>
</td>
</apex:repeat>
</tr>
</apex:repeat>
</table>
</apex:outputpanel>
here p1 is list of lists
the output is:
staus1
chbox status2 chkbox status3
chkbox status4 chkbox status4
status2
chkbox status1 chkbox status3
chkbox staus4 chkbox status5
...
now if i select status2 status 3under status1
i need to update the custom object with those values.
how can i get those values when click the checkbox
is there anyway to read values from those listof lists.
Hi saimadhu,
After taking a glance at your post, I would suggest you to make use of public get;set; list of wrapper class to bind checkbox values.
Please let me know if this helps.
Thanks for the reply.Iam new to this salesforce.
could you show me how to use wrapper classes
and this is my controller for my vf page
could you suggest where do i need to change my controller class
public List<Status_Option__c> statop {get;set;}
public class sublist
{
public boolean chklist{get;set;}
public string submenu{get;set;}
}
public class statuslist{
public string statusName{get;set;}
public list<sublist> statussubmenu = new list<sublist>();
public list<sublist> getstatussubmenu()
{
return statussubmenu;
}
}
public void updatestatusop()
{
statusop = true;
List<Status_Option__c> statop = new List<Status_Option__c>([select Name,Current_Build_Status__c,Next_Build_Status__c
from Status_Option__c
where Product_Group__c = :productId ]);
system.debug('list size is:'+statop.size());
for(integer i=0;i<statop.size();i++)
{
statuslist tmp =new statuslist();
system.debug('status name is'+statop.get(i).Name);
tmp.statusName = statop.get(i).Name;
system.debug('values in statusoption are:'+tmp.statusName);
for(integer j=0;j<statop.size();j++)
{
sublist tmp1 = new sublist();
if(i==j)
{
system.debug('$$$$$$$$$$$ we are in if statment$$$$$$$$$$$$$$$');
continue;
}
else
{
tmp1.chklist = false;
tmp1.submenu = statop.get(j).Name;
tmp.statussubmenu.add(tmp1);
system.debug('*****we are in else*************************');
//tmp1.statussubmenu.add(statop.get(j).Name);
system.debug('status name in inner loop is is'+tmp);
}
}
parentlist.add(tmp);
}
}
Hi,
try the following way
Hi saimadhu,
I am bit confused over your controller code.
You are using nested for loop(which should be avoided to extent possible) for iterating over same list to generate submenu for each Status_Option__c record with all other Status_Option__c records belonging to Product_Group__c value.
So this would result in following output with menus and sub-menus if you have 3 Status_Option__c with names A, B, C:
A
- B
- C
B
- A
- C
C
- A
- B
I would love to help if you could brief me through business goal you want to achieve with respect to item that should be considered as main-menu and sub-menu.