0
<section class="panel profile-info">
<apex:inputTextarea rows="2" value="{!pagepost}" styleClass="form-control input-lg p-text-area" id="postingonpage" />
    <div class="panel-footer" style="min-height:50px;padding: 5px;">
        <apex:commandButton styleClass="btn btn-danger pull-right" value="Post" id="post" action="{!postit}" reRender="postrepeat">                              
        </apex:commandButton>                                
    </div>
</section> 
<apex:outputPanel rendered="true" id="postrepeat">                    
<apex:repeat value="{!objmappost}" var="post">
    <p class="fb-user-status">
        {!objmappost[post].MBT_SFFB__Message__c}                                      
    </p>
    <ul class="fb-comments">                                        
     <apex:repeat id="comment" rendered="{!objmappost[post].MBT_SFFB__Total_Comments__c> 0}" value="{!objmapcomment[post]}" var="comment">
     <li>
        <div class="cmt-details">
            <a href="{!comment.MBT_SFFB__Author_URL__c}">{!comment.MBT_SFFB__Author_Realname__c}</a>
            <span>{!comment.MBT_SFFB__Message__c}</span> 
            <p>{!comment.MBT_SFFB__Published_Date_Formula__c} <a href="#" class="like-link">Like</a></p>
        </div>
    </li>
    </apex:repeat>                                             
    <li>
    <div class="chat-cmt-btn">
        <apex:inputTextarea rows="2" value="{!pagecomment}" styleClass="form-control" id="pagecomment" />                                                    
    </div>
    <div class="btn-group">
        <apex:commandButton styleClass="btn btn-danger" value="Comment" action="{!commentit}" reRender="postrepeat">
            <apex:param name="comment" value="{!objmappost[post].MBT_SFFB__External_ID__c}" id="postidoffbcomment"  assignTo="{!postidoffbcomment}"/>        
        </apex:commandButton>
    </div>
 </li>                                      
</ul>                                             
 </apex:repeat>
</apex:outputPanel>

Controller:-

public string pageid{get;set;}
public string postidoffb{get;set;}
public string pagecomment{get;set;}
public string postidoffbcomment{get;set;}
public pagereference commentit()
{
    System.Debug(pagecomment);
    System.Debug(pageid);
    System.debug(postidoffbcomment);
}

Output:-

null
16163671782332343434
16163671782332343434_1616367232434243

It should be Textbox value rather than null

5
  • 2
    You should use a List of wrapper class property to capture data in apex:repeat. If you bind single property in repeat, it would give unexpected result as you are getting.
    – Raul
    Commented Jan 25, 2017 at 8:06
  • Thank you @RahulSharma can you Please share any example code ? Commented Jan 25, 2017 at 8:08
  • Try playing with wrapper classes
    – Raul
    Commented Jan 25, 2017 at 8:23
  • Does that class even go with that page. I do not see any of you binded variables in the class?
    – Eric
    Commented Jan 25, 2017 at 8:25
  • @Erik looks like postidoffbcomment is passed using spex:param
    – Raul
    Commented Jan 25, 2017 at 8:37

1 Answer 1

1
String pgp='';
if(objmappost.size()>0)
    {
        for(String key:objmappost.keySet()) // map you had binded in the outer repeater.
        { 

            if((objmappost.get(key).postcomment)!='')
            {
              pgp =objmappost.get(key).postcomment;
             postidoffbcomment=objmappost.get(key).post.MBT_SFFB__External_ID__c;

            }
        }        
    }
     if((pgp!=null)&&(pgp!='')&&(pgp!=' '))
    {
        // call the facebook API and add commment method to insert the data in salesforce 
    }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .