+ Start a Discussion
Jack MichudaJack Michuda 

Create responsive cells in pageBlockTable

Hello, I'm a bit new to Salesforce development. But I've managed to piece together some code that creates an editable table. However, I'm now trying to integrate a responsive cell. Specifically, I would like the "Membership Fee" column to respond to the selection of any of the five inputCheckboxes. If a box is selected, I want the Membership Fee to increment by a specific value, and for that value to be displayed in the Membership Fee column.

Is this possible? How would I go about doing this?
 
<apex:page standardController="account">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!Save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:variable var="sr" value="{!0}"/>
            <apex:pageBlockTable value="{!account.contacts}" var="contact" rows="8">
                <apex:column headerValue="Membership Number"><apex:variable var="sr" value="{!sr + 1}"/>
                  {!sr}
                   </apex:column>  
                <apex:column headerValue="Reserved"><apex:inputCheckbox /></apex:column>
                <apex:column headerValue="Shared"><apex:inputCheckbox /></apex:column>
                <apex:column headerValue="Nights & Weekends"><apex:inputCheckbox /></apex:column>
                <apex:column headerValue="Small Office"><apex:inputCheckbox /></apex:column>
                <apex:column headerValue="Large Office"><apex:inputCheckbox /></apex:column>
                <apex:column headerValue="Membership Fee"><apex:inputText /></apex:column> %make this automatically update based on click of inputCheckbox
                <apex:column headerValue="Start Date"><apex:inputText /></apex:column>
                <apex:column headerValue="End Date"><apex:inputText /></apex:column>
                <apex:column headerValue="Comments"><apex:inputText /></apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
omm ommomm omm
hi jack have a look of the bellow code . This may help you 

<apex:page standardController="contact" extensions="accttest">
    <apex:form >
    <apex:pageBlock >
     
    </apex:pageBlock>
        <apex:pageBlock >
        <apex:pageBlockTable value="{!accts}" var="ac">
        <apex:column value="{!ac.name}"/>
         <apex:column value="{!ac.lastname}"/>
         <apex:column value="{!ac.sum__c}"/>
         <apex:column headerValue="invrement">
         <apex:inputCheckbox value="{!increment}"/>
         </apex:column>
        </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

=============================================================
public class accttest {

    public accttest(ApexPages.StandardController controller) 
    {
        
       accts=[select id, name, lastname, sum__c from contact where sum__c>0]; 
       if (increment= true)
       {
       inc();
       }
    }
    public list <contact>accts{get;set;}
    
    public boolean increment{get;set;}
    
   public void inc()
   {
    /*for (contact c: accts)
    {
      if(increment== true)
      {
       c.sum__c=c.sum__c+10;
      }
    }*/
   
    for (contact c:accts)
    {
     c.sum__c+=10;
     system.debug('****-*-*-*-'+ c.sum__c);
    }
    
   }
   
 }