0 Replies Latest reply on Sep 27, 2007 4:02 PM by mwkohout

    how to do/mimic partial form submission

    mwkohout

      I've got a Seam 2 application with a page where a user is creating/updating a model
      object. In this case, a Study(I work at a University, writing software for medical testing).
      A Study has several simple required fields(such as name) and can have one or more
      subelements in a set(such as a list of StudySubjects/guinea pigs).

      So far, I've got a page with a simple form that allows users of my system to create a
      Study, set names and add study subjects. However, after adding validation requiring a
      name, if this field isn't filled when adding to the model's set of study subjects, the page fails
      validation.

      What I would like to have happen is that the a4j commandbutton that adds the study
      subject should just submit the few select fields related to the study subject(in this case,
      the study subject's start, end, and "consent given" dates). Can I do this? How?

      here is a simplified version of the facelet:

      <h:form>
       <rich:panel id="bodyPanel">
       <h:panelGrid>
       <f:facet name="header">Set up a New Study</f:facet>
       <h:panelGroup>
       <f:facet name="header">
       Select Members and Roles
       </f:facet>
       <h:panelGrid>
       <s:decorate template="layout/edit.xhtml">
       <ui:define name="label">Study Name</ui:define>
       <h:inputText id="studyNameBox" value="#{study.name}" required="true" >
       </h:inputText>
       </s:decorate>
      
       <h:panelGrid id="subjectPanelGrid">
       <h:panelGroup>Search for potential subject by name</h:panelGroup>
       <h:inputText id="subjectSearchBox" value="#{studySubjectAction.subjectSearch}" immediate="true">
       <a4j:support event="onkeypress" requestDelay="1500" reRender="subjectPanelGrid"
       ignoreDupResponces="true" eventsQueue="myQueue" ajaxSingle="true"/>
       </h:inputText>
       <rich:dataTable id="subjectSelectList" value="#{studySubjectHome.findActiveOrCreate(
       subjectHome.findSubjects(studySubjectAction.subjectSearch ),study )}" var="studySubject" >
       <f:facet name="header">Subject Search Results </f:facet>
       <rich:column><f:facet name="header">Name</f:facet>
       #{studySubject.subject.firstName} #{studySubject.subject.lastName}
       </rich:column>
       <rich:column><f:facet name="header">Date Of Birth</f:facet>
       <h:outputText value="#{studySubject.subject.dateOfBirth}">
       <f:convertDateTime pattern="MM/dd/yyyy"/>
       </h:outputText>
       </rich:column>
       <rich:column>
       <f:facet name="header">Add to Study</f:facet>
       <h:panelGrid>
       <h:panelGroup>
       <s:decorate template="layout/edit.xhtml">
       <ui:define name="label">Enrolled Date</ui:define>
       <rich:calendar value="#{studySubject.enrolledDate}" />
       </s:decorate>
       </h:panelGroup>
       <h:panelGroup>
       <s:decorate template="layout/edit.xhtml">
       <ui:define name="label">Consent Date</ui:define>
       <rich:calendar value="#{studySubject.consentDate}" />
       </s:decorate>
       </h:panelGroup>
       <h:panelGroup>
       <s:decorate template="layout/edit.xhtml">
       <ui:define name="label">Exit Date</ui:define>
       <rich:calendar value="#{studySubject.exitDate}" />
       </s:decorate>
       </h:panelGroup>
       </h:panelGrid>
       <a4j:commandButton type="submit" value="Add"
       rendered="#{!study.studySubjects.contains(studySubject)}"
       action="#{studySubjectAction.add(studySubject)}" reRender="subjectPanelGrid"/>
       <a4j:commandButton type="submit" value="Remove"
       rendered="#{study.studySubjects.contains(studySubject)}"
       action="#{studySubjectAction.remove(studySubject)}" reRender="subjectPanelGrid"/>
       </rich:column>
       </rich:dataTable>
      
       </h:panelGrid>
       </h:panelGroup>
       <a4j:commandButton type="submit" value="Save Study" action="#{newStudyAction.save()}" reRender="bodyPanel"/>
      </h:form>