[SalesForce] Passing changed value in inputField to Controller using apex:param

</apex:column>
<apex:column headerValue="Capacity" id="CapacityColumn">
    <apex:inputField id="cap" value="{!fest.Capacity__c}"  rendered="{!isEditable}" >
        <apex:actionSupport event="onclick"                               
                            rerender="text" status="counterStatus">
            <apex:param assignTo="{!counting}"  value="this.value" />
        </apex:actionSupport>
    </apex:inputField>
</apex:column>

output2: <apex:outputtext id="text"  value="{!TextValue}"/>

Controller:

String Counting;
public String getTextValue() {      

        return counting;
    }

As shown in the above code, I am trying assign the changed inputfield value to Counting variable in controller class and display it in some other element. However, the values is not getting assigned and showing null value in System.debug statements in controller class. Can anyone please help.

Best Answer

In this case there is no need to specify an apex:param because apex:actionSupport will transmit the view state (including the current value of fest.Capacity__c) back to the server. So the simplest solution is to remove the apex:param and String Counting; and change the get method to this:

public String getTextValue() {      
    return String.valueOf(fest.Capacity__c);
}