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

Passing apex:inputText values to controller error



I am new to salesforce..
I am iterating textbox in apex:datalist




<apex:datalist value="{!a}" var="temp">

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


         <apex:inputText   id="commentBody"   value="{!x}"/>


                     <apex:commandButton action="{!commentFunction}" value="Submit" >
                                          <apex:param name="commentUserId" value="{!$User.Id}"/>
                                        <apex:param name="postIdcomment" value="{!a.Id}"/>



Now on click of submit when I try to get the value of text box I am getting the null value as the value for last textbox is null.

How to I dynamically iterate textbox so that values will get captured correctly in controller?
Also the the param values are getting captured null
Any pointers will be helpfull.



Can you paste the controller code as well here.


public  class ProfilePageController {

    public String x { get; set; }


 public PageReference commentFunction(){
                       String userIdcomment=apexpages.currentpage().getparameters().get('commentUserId');
                       String postIdcomment=apexpages.currentpage().getparameters().get('postIdcomment');
                       String postEntityIdcomment=apexpages.currentpage().getparameters().get('postEntityIdcomment');
                      FeedComment feedCommentItem = new FeedComment();

                        system.debug('PostId : '+postIdcomment) ;                  
                      List <FeedItem> items=[Select ID from FeedItem where parentId=:postIdcomment];
                      String eId = items.get(0).Id;
                      system.debug('FeedUpdate : '+this.x);
                      feedCommentItem.CommentBody='Test Comment';
                      insert feedCommentItem;                  
          return null;







This is the controller of my page...


Does the list a have desired values or is that null as well? By 'a' I mean the List which you are using as the source for the datalist


It is a NewsFeed list and it has all desired values..
Remainig functionality working properly.

Giving an error in this.