This content has been marked as final.
Show 4 replies
-
1. Re: accessing hidden field values in a SFSB
asookazian Oct 22, 2007 3:39 PM (in response to asookazian)I tried accessing the rowIndex, for example, in the SFSB via the SessionContext Seam object and that returned null as well...
-
2. Re: accessing hidden field values in a SFSB
dustismo Oct 22, 2007 4:05 PM (in response to asookazian)In your example, you would want to use a normal
<input type="hidden" name="rowIndex" />
rather then <h:inputHidden>
or else change this
(String) map.get("rowIndex");
to the actual generated name of the field (something like formName:rowIndex).
best,
Dustin -
3. Re: accessing hidden field values in a SFSB
asookazian Oct 22, 2007 4:40 PM (in response to asookazian)thx for reply. I tried the <input type="hidden" .../> as below, but the setter methods are still not being called for these hidden fields. The way I have to reference the hidden fields is different now (no a4jForm prepended to it).
setNoteText() is being called ok.<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.ajax4jsf.org/rich" xmlns:a4j="https://ajax4jsf.dev.java.net/ajax" template="layout/template.xhtml"> <ui:define name="body"> <script type="text/javascript"> function processNote(rButton, rowIndex, colName) { //if they clicked no, popup modal response window for note if (rButton.value == 'false') { //if condition below is optional; there are no other rButtons on the form at this time... if (colName == 'accountApproved' || colName == 'secLevelApproved' || colName == 'adjLimitApproved') { siteId = document.getElementById("mainForm:dataTable1:"+rowIndex+":siteId").value; employeeNumber = document.getElementById("mainForm:dataTable1:"+rowIndex+":employeeNumber").value; /* alert('rowIndex = ' + rowIndex); alert('siteId = ' + siteId); alert('employeeNumber = ' + employeeNumber); alert('colName = ' + colName); */ Richfaces.showModalPanel('mp',{width:450, top:200, param1: rowIndex, param2: colName, param3: siteId, param4: employeeNumber}); //set hidden variables in modalPanel form document.getElementById("rowIndex").value = rowIndex; document.getElementById("colName").value = colName; document.getElementById("siteId").value = siteId; document.getElementById("employeeNumber").value = employeeNumber; } } } function editNote(obj) { value1 = 'Please edit your note'; Richfaces.showModalPanel('mp',{width:450, top:200, param1: value1}); } </script> <h:messages globalOnly="true" styleClass="message"/> <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 id="a4jForm"> <h:inputText value="#{noteAction.noteText}"/> <input type="hidden" id="rowIndex" value="noteAction.rowIndex"/> <input type="hidden" id="colName" value="noteAction.colName"/> <input type="hidden" id="siteId" value="noteAction.siteId"/> <input type="hidden" id="employeeNumber" value="noteAction.employeeNumber"/> <a4j:commandButton value="submit" action="#{noteAction.submit}" onclick="Richfaces.hideModalPanel('mp')"/> </a4j:form> </rich:modalPanel> <h:form> <h:inputText value="#{securityAuditAction.networkId}"/> <h:commandButton value="Submit"/> </h:form> <h:form id="mainForm"> <h:outputText value="No Direct Reports" rendered="#{myAuditList != null and myAuditList.rowCount==0}"/> <h:dataTable id="dataTable1" value="#{myAuditList}" var="myRow" rendered="#{myAuditList.rowCount>0}" bgcolor="#F1F1F1" border="10" width="100%" cellpadding="0" cellspacing="0" dir="LTR" frame="hsides"> <h:column> <f:facet name="header">Employee Name</f:facet> <!-- siteId and employeeNumber hidden fields are used for all radio buttons --> <h:outputText id="empName" value="#{myRow[0].id.employeeName}"/> <h:inputHidden id="siteId" value="#{myRow[0].id.siteId}"/> <h:inputHidden id="employeeNumber" value="#{myRow[0].id.employeeNumber}"/> </h:column> <h:column> <f:facet name="header">SiteId</f:facet> <h:outputText value="#{myRow[0].id.siteId}"/> </h:column> <h:column> <f:facet name="header">EmployeeNumber</f:facet> <h:outputText value="#{myRow[0].id.employeeNumber}"/> </h:column> <h:column> <f:facet name="header">Account Approved?</f:facet> <h:selectOneRadio value="#{myRow[1].icomsAccountApproved}" onclick="processNote(this, #{myAuditList.getRowIndex()}, 'accountApproved')"> <f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" /> </h:selectOneRadio> <h:graphicImage value="/img/icon_edit.gif" onclick="editNote(this);"/> </h:column> <h:column> <f:facet name="header">Security Level Approved?</f:facet> <h:selectOneRadio value="#{myRow[1].securityLevelApproved}" onclick="processNote(this, #{myAuditList.getRowIndex()}, 'secLevelApproved');"> <f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" /> </h:selectOneRadio> <h:graphicImage value="/img/icon_edit.gif" onclick="editNote(this);"/> </h:column> <h:column> <f:facet name="header">Adjustment Limit Approved?</f:facet> <h:selectOneRadio value="#{myRow[1].adjustmentLimitApproved}" onclick="processNote(this, #{myAuditList.getRowIndex()}, 'adjLimitApproved');"> <f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" /> </h:selectOneRadio> <h:graphicImage value="/img/icon_edit.gif" onclick="editNote(this);"/> </h:column> </h:dataTable> <h:commandButton value="submit" action="#{securityAuditAction.submit}" rendered="#{myAuditList.rowCount>0}"/> </h:form> </ui:define> </ui:composition>
-
4. Re: accessing hidden field values in a SFSB
asookazian Oct 22, 2007 5:00 PM (in response to asookazian)ok thx bro. your 2nd suggestion worked:
FacesContext fc = FacesContext.getCurrentInstance(); Map map = fc.getExternalContext().getRequestParameterMap(); String rowIndex = (String) map.get("a4jForm:rowIndex"); log.info("rowIndex = " + rowIndex); String colName = (String) map.get("a4jForm:colName"); log.info("colName = " + colName); String siteId = (String) map.get("a4jForm:siteId"); log.info("siteId = " + siteId); String employeeNumber = (String) map.get("a4jForm:employeeNumber"); log.info("employeeNumber = " + employeeNumber);
the correct values were outputted in the log. this stuff is such a pain in the ass, wow....