You need to sign in to do that
Don't have an account?
Rajgottipolu
Problem with wrapper class
hello...
I wanted to create a page block table with checkboxes that'll let the user select one checkbox at a time (more like a radio button). I used wrapper classes for that. Everything seems to work fine but occasionally when i select an option...nothing happens.
Here is the vf page im using:
<apex:pageBlock Title="SELECT THE CONTACT ASSOCIATED TO THE CURRENT ACCOUNT" rendered="{!contactdisplay}" id="pageBlock"> <apex:outputLabel >Please click on 'Last Name' to sort</apex:outputLabel> <apex:pageBlockSection rendered="{!location}"> <apex:outputLabel ><p style="font-family:verdana;color:red;"> Error: Please select atleast one option. </p> </apex:outputLabel> </apex:pageBlockSection> <apex:pageBlockSection columns="1" collapsible="false"> <apex:pageBlockTable value="{!contactlocations}" var="cl"> <apex:column > <apex:facet name="header"> </apex:facet> <apex:inputCheckbox value="{!cl.selected}" id="checkedone"> <apex:actionSupport event="onchange" action="{!GetSelected2}" onsubmit="deselectOther2(this)" rerender="Selected_PBS" /> </apex:inputCheckbox> </apex:column> <apex:column value="{!cl.cin.FirstName}" /> <apex:column > <apex:facet name="header"> <apex:commandLink action="{!ViewData}" reRender="pageBlock" value="Last Name{!IF(sortExpression=='lastname',IF(sortDirection='ASC','▼','▲'),'')}" id="cmdSort" status="sorting"> <apex:param value="lastname" name="column" assignTo="{!sortExpression}" /> </apex:commandLink> </apex:facet> <apex:outputLink value="/{!cl.cin.LastName}" target="_blank" />{!cl.cin.LastName} </apex:column> <apex:column value="{!cl.cin.Phone}" /> <apex:column value="{!cl.cin.Email}" /> <apex:column value="{!cl.cin.Title}" /> <apex:column value="{!cl.cin.MailingCity}" /> <apex:column value="{!cl.cin.MailingState}" /> <apex:column value="{!cl.cin.AccountId}" /> </apex:pageBlockTable> </apex:pageBlockSection> <apex:pageblockButtons > <apex:commandButton action="{!foundContact}" value="NEXT"/> <apex:commandButton action="{!notFound1}" value="NOT FOUND"/> </apex:pageblockButtons></apex:pageblock>
}
function deselectOther2(chkBox2) { if (chkBox2.checked) { if ((chkBox2 != selectedChkbox2) && (selectedChkbox2 != null)) { selectedChkbox2.checked = false; } selectedChkbox2 = chkBox2; }
There's a couple of things I use when hitting these kind of problems:
(1) Add an apex:pagemessages component to the page - it may be that there's an error occurring somewhere down the line
(2) Add an actionstatus to the actionsupport and write some text to ensure that the request starts and completes correctly.
Is it a race condition? I.e. do you only see it after making more than one selection?
All Answers
There's a couple of things I use when hitting these kind of problems:
(1) Add an apex:pagemessages component to the page - it may be that there's an error occurring somewhere down the line
(2) Add an actionstatus to the actionsupport and write some text to ensure that the request starts and completes correctly.
Is it a race condition? I.e. do you only see it after making more than one selection?
Thanks bob!! apex status thing worked! u r god :)