function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Varun AnnadataVarun Annadata 

Help with param value

Vf Page:
<apex:page standardcontroller="Program_Member_MVN__c" extensions="ProgramMemberCaseAttachment" showHeader="false" >
 <head>
        <apex:includescript value="//code.jquery.com/jquery-1.11.1.min.js" / >
        <apex:includescript value="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js" />
        <apex:stylesheet value="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css" />
        <script>
            j$ = jQuery.noConflict();
            j$(document).ready( function () {
                var contactTable = j$('[id$="accounttable"]').DataTable({
                    
                });
            });
        </script>
 </head>
 
            
            
            <body>
            <table id="accounttable" class="display"  >
            <thead>
                <tr>
                    <th>Save</th>
                    <th>ID</th>
                    <th>Type</th>
                    <th>Case Number/PM Number</th>
                    <th>Attachment</th>
                    <th>LastModifiedDate</th>
                    <th>CreatedBy</th>
                    <th>Description</th>
                </tr>
            </thead>
            <tbody>  
            
                <apex:repeat value="{!wrapAttachmentList}" var="N"> 
                
                    <!--<apex:form>
                
                    <apex:pageBlock>
                
                    <apex:pageBlockTable value="{!PMTyperesults}" var="dimension2">
                    
                    <apex:column value="{!dimension2.Type__c}"/>
                    
                    </apex:pageBlockTable>
                    
                    </apex:pageBlock>
                    
                    </apex:form>-->
                
                    <tr>
                    
                    <apex:form >
   
            
                        <td><apex:commandButton value="save" action="{!processSelected}">
                        
                        <apex:param name="{!N.At.id}" value="{!N.At.id}" assignTo="{!Attid}"/>
                        
                        </apex:commandButton>
                        </td>
                         

                    </apex:form>
                    
                    <td><apex:outputtext value="{!Attid}"/></td>
                    
                    <apex:form >
                    
                    <td><apex:inputField value="{!N.Att.Type__c}" id="check"/></td>
                    
                    <apex:param name="{!N.Att.Type__c}" value="{!N.Att.Type__c}" assignTo="{!AttType}/>
                    
                    </apex:form>
                    
                    <td><apex:outputLink value="/{!N.At.ParentId}" target="_blank">{!N.At.Parent.Name}</apex:outputLink></td>    
                                         
                    <td><apex:outputLink value="/{!N.At.id}" target="_blank">{!N.At.Name}</apex:outputLink></td>
                   
                    <td>{!N.At.LastModifiedDate}</td>
                   
                    <td><apex:outputLink value="/{!N.At.CreatedById}" target="_blank">{!N.At.CreatedBy.Name}</apex:outputLink></td>
                   
                    <td>
                    <apex:outputField value="{!N.At.Description}"/></td>

                    </tr>    
                                                                       
                </apex:repeat>
            </tbody>
            </table>
            </body>
</apex:page>
Apex Class:
/**
 *  ProgramMemberCaseAttachment
 *  Created By:     Varun 
 *  Created On:     11/07/2017
 *  Description:    This class is responsible for displaying Attachment Details
                     Under Each Program Member
 *                  
 **/
public class ProgramMemberCaseAttachment{

    public String AttType{get;set;}

    public String act{get;set;}

    public Id Attid{get;set;}

    public List<wrapAttachment> wrapAttachmentList {get; set;}
    
    public List<Attachment> PMresults{get;set;}
    
    public List<Attachment_Type__c> PMTyperesults{get;set;}
    
    public Program_Member_MVN__c cs;
    
    public ProgramMemberCaseAttachment(ApexPages.StandardController controller)
    {
    
    wrapAttachmentList = new List<wrapAttachment>();
    
    cs=(Program_Member_MVN__c)controller.getRecord();
        
    List<case> Test = new List<case>([select id from case where Program_Member_MVN__c =: cs.id]);
    
    System.debug('Test:'+Test);
    
    PMresults = [select CreatedBy.Name,OwnerId,ParentId,Parent.Name,Id,Name,LastModifiedById,CreatedById,LastModifiedDate, Description from Attachment where parentid =: cs.id OR parentid IN:Test ];
    
    for(Attachment a : PMresults) {
            wrapAttachmentList.add(new wrapAttachment(a));
        }

    
    PMTyperesults = new List<Attachment_Type__c>();
    
    for(Attachment_Type__c b : PMTyperesults) {
            wrapAttachmentList.add(new wrapAttachment(b));
        }

    }
    
    public void processSelected(){
    
    act =System.currentPageReference().getParameters().get('Mahavir');
    
    System.debug('act:'+act);
    
    List<Attachment_Type__c> PMType = new List<Attachment_Type__c>();
    
    Attachment_Type__c At1 = new Attachment_Type__c ();
    
    At1 = [select Type__c from Attachment_Type__c where Attachment_Id__c =: Attid];
    
    At1.Type__c  = AttType;
    
    PMType.add(At1);
    
          set<Attachment_Type__c> dedupSet = new set<Attachment_Type__c>();
          dedupSet.addAll(PMType);
          List<Attachment_Type__c> dedupList = new List<Attachment_Type__c>();
          dedupList.addAll(dedupSet);
          Update dedupList;
    //update PMType;
    }
     public class wrapAttachment {
        public Attachment At {get; set;}
        public Attachment_Type__c Att{get; set;}
 
        public wrapAttachment(Attachment a) {
        
            At = a;
        }
        public wrapAttachment(Attachment_Type__c b){
        
            Att = b;
        
        }
    }
}
I am trying to pass Attachment Id from save and Attachment Type from inputfield but it is returning null in my apex class.

The functionality i am tryign is On click of save button whatever is saved in the type input field will be updated in another custom object record.

This is my vf page section in record detail page:

User-added image

What am i doing wrong why isnt the param tag not passing the value to apex class?

 
Dushyant SonwarDushyant Sonwar

Try changing the apex:param name with hardcode value .
<apex:param name="{!N.At.id}" value="{!N.At.id}" assignTo="{!Attid}"/>
​<apex:param name="attid" value="" assignTo="{!Attid}"/>

if that didn't work , then try rerendering by giving your <apex:pageBlock id="pgblock"> to rerender

<apex:commandButton value="save" action="{!processSelected}" rerender="pgblock">
​<apex:param name="attid" value="" assignTo="{!Attid}" />
 

Varun AnnadataVarun Annadata
Tried what u said.Still the id or type is not passing
Dushyant SonwarDushyant Sonwar
Change your vf page to only one apex:form , currently your vf page has 2 apex:form that is wrong 
try using below code to one apex:form 
<apex:form >  
<body>
            <table id="accounttable" class="display"  >
            <thead>
                <tr>
                    <th>Save</th>
                    <th>ID</th>
                    <th>Type</th>
                    <th>Case Number/PM Number</th>
                    <th>Attachment</th>
                    <th>LastModifiedDate</th>
                    <th>CreatedBy</th>
                    <th>Description</th>
                </tr>
            </thead>
            <tbody>  
            
                <apex:repeat value="{!wrapAttachmentList}" var="N"> 
                
                    
                
                    <tr>
                    
                    
   
            
                        <td><apex:commandButton value="save" action="{!processSelected}">
                        
                        <apex:param name="{!N.At.id}" value="{!N.At.id}" assignTo="{!Attid}"/>
                        
                        </apex:commandButton>
                        </td>
                         


                    
                    <td><apex:outputtext value="{!Attid}"/></td>
                    

                    
                    <td><apex:inputField value="{!N.Att.Type__c}" id="check"/></td>
                    
                    <apex:param name="{!N.Att.Type__c}" value="{!N.Att.Type__c}" assignTo="{!AttType}/>
                    

                    
                    <td><apex:outputLink value="/{!N.At.ParentId}" target="_blank">{!N.At.Parent.Name}</apex:outputLink></td>    
                                         
                    <td><apex:outputLink value="/{!N.At.id}" target="_blank">{!N.At.Name}</apex:outputLink></td>
                   
                    <td>{!N.At.LastModifiedDate}</td>
                   
                    <td><apex:outputLink value="/{!N.At.CreatedById}" target="_blank">{!N.At.CreatedBy.Name}</apex:outputLink></td>
                   
                    <td>
                    <apex:outputField value="{!N.At.Description}"/></td>

                    </tr>    
                                                                       
                </apex:repeat>
            </tbody>
            </table>
            </body>
</apex:form >