3 Replies Latest reply on Feb 8, 2009 2:44 AM by valatharv

    Facing issue with s:decorate

    valatharv
      Facing issue with s:decorate.

      I am using "h:commandButton" which opens modal panel.

      a) Issue is even when value in "h:selectOneMenu" is selected, and I click h:commandButton "Save", it still says "Please select experiment type".

      b) If I do not use "s:decorate", and click on "Save" I don't get wrong validation message (Please select experiment type....) but required validation will not work if "h:selectOneMenu" is not selected.

      Note : If I use "h:commandLink", validation as well as modal works fine. But as per requirement we need to use button

      Please suggest, how can I overcome this....

      <a:region renderRegionOnly="false">
      <s:decorate id="experimentnType" template="layout/edit.xhtml">
      <ui:define name="label">Experiment Type :</ui:define>
           <h:selectOneMenu value="#{quantExperimentHome.instance.experimentType}" 
           id="expType" styleClass="message" required="true" requiredMessage="Please select experiment type">     
                <f:selectItem itemValue="" itemLabel="Select type..."/>                                   
                <f:selectItem itemValue="AAA" itemLabel="AAA"/>
                <f:selectItem itemValue="BBB" itemLabel="BBB"/>
                <f:selectItem itemValue="CCC" itemLabel="CCC"/>  
                <a:support event="onchange" reRender="reagentPanel"/>
           </h:selectOneMenu>
      </s:decorate>
      </a:region>

      <h:commandButton id="save" title="Creates new project"
                  value="Save"
                 action="#{projectHome.persist}"
              disabled="#{!projectHome.wired}"
              rendered="#{!projectHome.managed}">
         <rich:componentControl for="panel" attachTo="save" operation="show" event="onclick"/>
      </h:commandButton>
        • 1. Re: Facing issue with s:decorate

          I am kind of lost here. What exactly are you trying to do with modal panel? Are you trying to display error message if validation fails?
          Why do you have a:region around s:decorate?

          • 2. Re: Facing issue with s:decorate
            valatharv

            Thanks for the quick reply Binesh.


            I really don't have any good answer for a:region, but we are changing some other fields in different panel on the basis on this.


            For Modal panel, I am showing request in progress message when user clicks update.


            a) It is strange that the same thing works fine if I use h:commandLink
            i.e. it does not validates for required values if value IS selected in dropdown.


            b) When I use h:commandButton and SELECT value in dropdown h:selectOneMenu and click h:commandButton Save it still validates and says Please select experiment type.. EVEN IF value is selected to AAA or BBB or CCC


            Please let me know if still more info is required and I am thankful again for taking care of it.

            • 3. Re: Facing issue with s:decorate
              valatharv

              Also, behavior is same even if I do not use a:region or a:support