2

I have a problem with the rerender attribute not working when i try to use it within a visualforce component. Here is my code:

My component:

<apex:component controller="zTestController" id="myComponent">
  <apex:form >
    <apex:inputText value="{!text}" id="myText"/>
    <apex:commandButton action="{!someAction}" reRender="{!$Component.myComponent}" value="testButton"/>
  </apex:form>
</apex:component>

My page:

<apex:page >
  <c:zTestComponent />
</apex:page>

The controller class:

public class zTestController {
  public String text {get; set {
    text = (value!=null?value:'') + 'X';
  }}

  public void someAction() {
  }
}

When i click on the button, nothing happens. If i remove the rerender attribute, the button works. If i don't use a component and copy the content to the page, the button works.

I did not find any reported bugs about this, so am i doning wrong? any Ideas? Thank you!

1 Answer 1

2
<apex:component controller="zTestController">
 <apex:form >
   <apex:outputPanel id="myComponent">
     <apex:inputText value="{!text}" id="myText"/>
 </apex:outputPanel>
<apex:commandButton action="{!someAction}" reRender="myComponent" value="testButton"/>

I always use outputPanel whenever i reRender and also i use pagereference method and return null

public class zTestController {
  public String text {get; set {
   text = (value!=null?value:'') + 'X';
 }}

    public pagereference someAction() {
      return null;
   }
}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .