1
</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.

3
  • Are you looking at the debug logs after you have clicked? I would try to add a debug statement in your getTextValue method just to see if its getting called or not. If your method is getting called, then for the value to be visible in your other text field you need to rerender that particular component or its parent component – Prady Nov 24 '14 at 13:23
  • I added a debug statement in this method and it is getting called. – Abilash Nov 24 '14 at 15:50
  • So, are you getting the value that you want in the debug statement or its null? – Prady Nov 24 '14 at 16:21
1

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);
}
1
  • This is throwing the error variable not declared as fest.Capacity__c is declared in visualforce page but not on Controller – Abilash Nov 24 '14 at 15:57
0

If you are using assignto=, then the controller property needs to have a public setter as in

public Counting {get; set;}

Furthermore, the value of the value= attribute will literally be this.value. VF has no idea what this is. The param value assigned to the controller will be the string "this.value" - i.e. a 10 character string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.