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

Render the value of outputfield after click on it (without button)



i am developing an application that is comparable to a email client.  I have a pageblocktable with the emails and various field of the single mail.

I have a formula field too. I use this field to call some images and use it to create the "outlook flag follow up"(on a object "Email__c" there is a field "flagstatus__c" and formula field "flag__c" ):

  1. If the flagstatus__c is  "NULL" -> GRAY FLAG 
  2. If the flagstatus__c is  "TO_DO"-> RED FLAG
  3. If the flagstatus__c is "COMPLETE" -> CHECK FLAG
CASE(FlagStatus__c , "TO_DO",IMAGE("/resource/FlagRed",""), "COMPLETE", IMAGE("/resource/FlagCompleted",""),IMAGE("/resource/FlagNull",""))



I have no button to rerender the value of this field but i call a remoteaction after click on the flag(now is in outputtext, but i think that with an outputfield i have the same result). The remote action update the value but this it is not rendered on the table in the page.

How i can render the value without using a button (with the option "rerender=")? The problem is that the remote action is asynchronous?


This is a part of the table :


<apex:pageBlockTable id="maintable" style="cursor:pointer" value="{!Emails}" var="e" columns="5" cellspacing="5"  onRowClick="show(this)" >

 <apex:column onclick="setRemoteFlagState('{!e.Id}');"   headerValue="State" width="4%"  >
				    	 <apex:outputText escape="false" value="{!e.Flag__c}"/>


 This is the remote action

    global static String setFlagState(String emailId) {
    	List<E2C_Email__c> emails = [select FlagStatus__c from E2C_Email__c where Id = :emailId];
    	if (emails.size() > 0) {
    		if (emails.get(0).FlagStatus__c=='NULL'){
    		return emails.get(0).FlagStatus__c;
    		else if (emails.get(0).FlagStatus__c=='TO_DO'){
    		return emails.get(0).FlagStatus__c;
    		return emails.get(0).FlagStatus__c;
    		System.debug('stato email '+emails[0].read__c);
    		return emails[0].Read__c;
    	} else {
    		System.debug('Nessuna Email corrispondente');
    		return null;

 This is the javascript code:

		function setRemoteFlagState(emailId) {
				        function(result, event){
				            if (event.status)
				                if (result.replace != null) {
				            } else if (event.type === 'exception') {
				                document.getElementById("responseErrors").innerHTML = event.message;
				            } else {
				                document.getElementById("responseErrors").innerHTML = event.message;
				        {escape: true}



I can't see the solution off the top of my head

but I'd suggest looking at apex:actionStatus with facets to put image code in the start and stop sections.