+ Start a Discussion
Pavan kumar 546Pavan kumar 546 

Can any one explain how this code will execute?


<apex:page controller="AccountSelectClassController" sidebar="false">
    <script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");
            for(var i=0; i<inputCheckBox.length; i++){
                if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
                    inputCheckBox[i].checked = obj.checked;
                }
            }
        }
    </script>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Show Selected Accounts" action="{!processSelected}" rerender="table2"/>
            </apex:pageBlockButtons>
 
            <apex:pageblockSection title="All Accounts" collapsible="false" columns="2">
 
                <apex:pageBlockTable value="{!wrapAccountList}" var="accWrap" id="table" title="All Accounts">
                    <apex:column >
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                        </apex:facet>
                        <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                    </apex:column>
                    <apex:column value="{!accWrap.acc.Name}" />
                    <apex:column value="{!accWrap.acc.BillingState}" />
                    <apex:column value="{!accWrap.acc.Phone}" />
                </apex:pageBlockTable>
 
                <apex:pageBlockTable value="{!selectedAccounts}" var="c" id="table2" title="Selected Accounts">
                    <apex:column value="{!c.Name}" headerValue="Account Name"/>
                    <apex:column value="{!c.BillingState}" headerValue="Billing State"/>
                    <apex:column value="{!c.Phone}" headerValue="Phone"/>
                </apex:pageBlockTable>
 
            </apex:pageblockSection>
        </apex:pageBlock>
    </apex:form>
 
</apex:page>
Best Answer chosen by Pavan kumar 546
JeffreyStevensJeffreyStevens
This is a visualforce page.  When the page loads, it will also use the APEX code in the apex class called AccountSelectClassController.  That controller will have a method called processSelected which get's executed on the Show Selected Accounts button.  The controller will also produce lists called wrapAccountList and selectedAccounts.

Thats the short version.  If you want to find and post the AccountSelectClassController code - I'm sure we could explain more.

All Answers

JeffreyStevensJeffreyStevens
This is a visualforce page.  When the page loads, it will also use the APEX code in the apex class called AccountSelectClassController.  That controller will have a method called processSelected which get's executed on the Show Selected Accounts button.  The controller will also produce lists called wrapAccountList and selectedAccounts.

Thats the short version.  If you want to find and post the AccountSelectClassController code - I'm sure we could explain more.
This was selected as the best answer
Pavan kumar 546Pavan kumar 546
Thanq Steven Now it is To understand