+ Start a Discussion
King KooKing Koo 

Expression language inside <apex:actionStatus>

Hi there

Got a bug today and was debugging it to death, but still at no avail.  Hope someone can help.  This is regarding <apex:actionStatus>.

I made my example really short.  So here is the controller:
public class ActionStatusController
{
    public String testVariable {get; set;}
    public pagereference donothing()
    {
        return null;
    }
}

And here is the VF page that uses the controller
<apex:page controller="ActionStatusController">
<apex:pageBlock id="pb">
<apex:form >
    <apex:selectList value="{!testVariable }" size="1">
        <apex:selectOption itemValue="" itemLabel="" />
        <apex:selectOption itemValue="a" itemLabel="a" />
        <apex:selectOption itemValue="b" itemLabel="b" />
        <apex:selectOption itemValue="c" itemLabel="c" />
        <apex:actionSupport event="onchange" reRender="testVariableDiv"/>
    </apex:selectList>
    <apex:commandButton action="{!doNothing}" value="Click" status="showStatus" rerender="pb"/>
</apex:form>
<apex:outputPanel id="testVariableDiv">
    <apex:outputText value="selected value is {!testVariable }" />
</apex:outputPanel><br/>
<apex:actionStatus id="showStatus">
<apex:facet name="start">
the value is "{!testVariable }"
</apex:facet>
</apex:actionStatus>
</apex:pageBlock>
</apex:page>

When the page loads, you see the picklist and then the statement that says "selected value is".

Once you pick, say, "c", then the statement becomes "selected value is c", which is expected.

However, when you then press the button, which in the facet/start is supposed to display the same value, it says "the value is ".

Now, if I press it again, then it displays "the value is c".  

It seems like the actionStatus is lagging by one step.  What must I change in order for the display to say "the value is c" as soon as I press the "Click" button?


Thanks
King


 
King KooKing Koo
BY the way I have a reRender on the pageblock on click of the button - that's because my page is doing some partial release.  I dont' want the page to be refreshed.

Thanks
King
VictorFelisbinoVictorFelisbino
I believe it's because on start the variable still blank since you haven't yet assigned the value to the variable, could you try changing that to stop and see what happens?
Amit Chaudhary 8Amit Chaudhary 8
Hi King Koo,

Please try below code
<apex:page controller="ActionStatusController">
<apex:form >
<apex:pageBlock id="pb">

    <apex:selectList value="{!testVariable}" size="1">
        <apex:selectOption itemValue="" itemLabel="" />
        <apex:selectOption itemValue="a" itemLabel="a" />
        <apex:selectOption itemValue="b" itemLabel="b" />
        <apex:selectOption itemValue="c" itemLabel="c" />
        <apex:actionSupport event="onchange" reRender="pb" action="{!donothing}"/>
    </apex:selectList>

    <apex:commandButton action="{!doNothing}" value="Click" status="showStatus" rerender="pb" />


    <apex:outputPanel id="testVariableDiv">
        <apex:outputText value="selected value is {!testVariable }" />
    </apex:outputPanel><br/>

    <apex:actionStatus id="showStatus" >
        <apex:facet name="start" >the value is "{!testVariable }"
        </apex:facet>
    </apex:actionStatus>
    
</apex:pageBlock>


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

Please mark this as best solution is this will help you.

Thanks
Amit Chaudhary
amit.salesforce21@gmail.com