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
jdeveloperjdeveloper 

Trouble diplaying object custom field in a dataTable

hi, I have this object book and a custom field comments__c. i want a user to be able to enter comments about the book in another page and view the comments of the book in another page. my controller is something like this

public class bookComments{

public String bookComments {get;set;}
public List<auction__c> auctions;
public List<String> bookIds = new List<String>();

public List<auction__c> getmybook(){

 

  auctions = [Select id, Name, BookAuctionId__c from action__c where id =: BookAuctionsId__c];

return auctions;

}

public PageReference acceptBookComments(){

for (auction__c b: auctions){
bookIds.add(c.id);
}
public List<books__c> mybooks = [Select id, Name, comments__c, bookAuctionsId__c from books__c where bookAuctionId__c IN bookIds ]

for (auction__c c: auctions){

mybooks.comments = bookComments
}

update mybooks;

}


}

 Then the visualforce page is like this.

<apex:page>
<apex:form>
<apex:dataTable var="auction" value="{!mybook}">
<column>
<apex:outputField value="{!auction.Name}"/>
</column>

<column>
apex:inputTextarea value="{!bookComments}"/>
</column>

</apex:dataTable>

</apex:form>
</apex:page>



Then i have another page that is supposed to show the comments entered.

<apex:page>
<apex:form>
<apex:dataTable var="books" value="{!showComments}">
<apex:outputField value="{!books.comments__c}"/>

</apex:dataTable>
</apex:form>
</apex:page>

 Sometimes it works, sometimes it doesnt

 

 

jdeveloperjdeveloper

i also figured out that if the page or datatable is rerendered then the comment__c field does show up. Is there a reason why and how can i fix that?