1 Reply Latest reply on Oct 22, 2007 2:38 PM by asookazian

    How to access hidden field values in action SB?

    asookazian

      I'm trying to access the values of hidden fields in a richfaces modal panel form submission. The accessing is happening in a stateful SB in a Seam environment with Seam 2.0.0.CR2 and JBoss 4.2.1.GA.

      Here is the .xhtml code snippet:

      <rich:modalPanel id="mp" minHeight="200" minWidth="450"
       height="200" width="500" zindex="2000" onshow="alert(event.parameters.param1); alert(event.parameters.param2); alert(event.parameters.param3); alert(event.parameters.param4)">
       <f:facet name="header">
       <h:outputText value="#{noteAction.header}" />
       </f:facet>
       <f:facet name="controls">
       <h:graphicImage value="/img/icon_edit.gif" style="cursor:pointer" onclick="Richfaces.hideModalPanel('mp')" />
       </f:facet>
       <a4j:form>
       <h:inputText value="#{noteAction.noteText}"/>
       <h:inputHidden id="rowIndex" value="event.parameters.param1"/>
       <h:inputHidden id="colName" value="event.parameters.param2"/>
       <h:inputHidden id="siteId" value="event.parameters.param3"/>
       <h:inputHidden id="employeeNumber" value="event.parameters.param4"/>
       <a4j:commandButton value="submit" action="#{noteAction.submit}" onclick="Richfaces.hideModalPanel('mp')"/>
       </a4j:form>
       </rich:modalPanel>


      Here is what I was trying to do with the FacesMessage object to access the variables in the request scope object (which are showing up as null in the console/server.log):

      public void submit() {
      
       FacesContext fc = FacesContext.getCurrentInstance();
       Map map = fc.getExternalContext().getRequestParameterMap();
       String rowIndex = (String) map.get("rowIndex");
       log.info("rowIndex = " + rowIndex);
       String colName = (String) map.get("colName");
       log.info("colName = " + colName);
       String siteId = (String) map.get("siteId");
       log.info("siteId = " + siteId);
       String employeeNumber = (String) map.get("employeeNumber");
       log.info("employeeNumber = " + employeeNumber);
       }


      as a test, I also tried the following test form in the same .xhtml file:
       <h:form>
       <h:inputText id="rowIndex" value="#{noteAction.rowIndex}"/>
       <h:inputText id="colName" value="#{noteAction.colName}"/>
       <h:inputText id="siteId" value="#{noteAction.siteId}"/>
       <h:inputText id="employeeNumber" value="#{noteAction.employeeNumber}"/>
       <h:commandButton value="submit" action="{#noteAction.submit}"/>
       </h:form>


      with the above form, the setter methods in the SFSB are firing upon submit of the form, but the values are null in the request object via the FacesMessage object.

      How are we to retrieve the hidden values from the modalPanel form in the SB???? thx.

        • 1. Re: How to access hidden field values in action SB?
          asookazian

          also the start of the SFSB is as follows:

          @Stateful
          //@Scope(ScopeType.SESSION)
          @Name("noteAction")
          public class NoteAction implements NoteLocal {
          ....
          }


          In Seam, when you don't declare the scope explicitly, it defaults to CONVERSATION I believe. So maybe that explains why the hidden variables are null in the request scope???