0

Below is the code snippet for the JSF popup. It correctly binds the controller.text value when the form is rendered. However when we click OK the value is not being set on backing bean.

Also I can see the form values being submitted in the post on the Chrome Network Tool.

<rich:popupPanel id="revisionTextBox" width="250" height="150">
       <f:facet name="header">Enter revision history text</f:facet>        
       <h:form method="post" action="#{controller.doSomething(this)}">
           <h:panelGrid>
              <h:inputTextarea
                id="text"
                binding="#{controller.text}"
                style="border-bottom-style: none; width:100%;overflow:hidden"
                disabled="false"
                immediate="true"
                cols="80"
                value="#{controller.textValue}"                 
                rows="7"
                >
                <f:ajax execute="@this @form"/>
                </h:inputTextarea>                      
              <h:panelGroup>
                 <h:commandButton type="button" value="OK" 
              onclick="#{rich:component('confirmation')}.hide();someFunction();return false" >                  
              </h:commandButton>
             <input type="button" value="Cancel"
              onclick="#{rich:component('confirmation')}.hide();return false" />
              </h:panelGroup>
           </h:panelGrid>
       </h:form>
    </rich:popupPanel>

Controller

@Controller
public class TreeController implements TreeToggleListener{

private UIComponent text;

private String textValue = "HI";


public String getTextValue() {
    return textValue;
}

public void setTextValue(String textValue) {
    this.textValue = textValue;
}

public UIComponent getText() {
    return text;
}

public void setText(UIComponent text) {
    this.text = text;
}

public void doAnotherSomething(){
    System.out.println("hi");
}
}
Rob
  • 1
  • 1
  • The binding seems unnecessary. You should also add `private String textValue = "";` to the controller. For your problem, the javascript of the OK button should `return true;` instead of `false`. When returning `false` nothing is submitted, – ForguesR Aug 23 '15 at 15:47
  • @ForguesR So I didn't do a good job cleansing the data but I have fixed it now...I also tried your solution. Adding return true after someFunction(); and it still did not work. I'm still getting Hi as the text – Rob Aug 24 '15 at 00:52
  • why is there a primefaces tag question here when I can't see any tags on the code provided? – Fritz Aug 24 '15 at 07:11

0 Answers0