Hidden Field value empty

1.5k Views Asked by At

I am trying to set hidden field value to backing bean in request scope but I see that the value the setter takes is empty "" though there is a value on client side(can see in firebug). Before the actionListener is invoked, the setter is invoked but the argument for plan is empty.

<managed-bean>
    <managed-bean-name>carController</managed-bean-name>
    <managed-bean-class>com.domain.myproject.controller.CarController</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
        <property-name>plan</property-name>
        <value>#{param.planUI}</value>
    </managed-property>
</managed-bean>


public class CarController {
     private String plan = "";
// getter and setter
}

main.xhtml

<h:form id="myForm">
    <input type="hidden" name="planUI" id="planUI" value=""/>
....
<ice:panelGroup>
  <ice:menuPopup id="popupmenu">
    <ice:menuItem id="item1" value="item" immediate="true" 
   onclick="document.getElementById("myForm:planUI").Value = 'test';"
    actionListener="#{someBean.listener}">
    </ice:menuItem>
  </ice:menuPopup>
</ice:panelGroup>
1

There are 1 best solutions below

0
On

There is a problem with the method you are calling just change your onclick to following.

onclick="document.getElementById('myForm:planUI').value = 'test';"

You should use single quotes inside double quotes and the use small v with value