3 Replies Latest reply on Feb 2, 2011 3:52 AM by anicapil

    show rich:modalpanel after request

    anicapil

      <a4j:commandButton id="sendButton"

                                                 value="#{messages.button_send_to_countries}"

                                                 action="#{productListManager.validateBeforeSendToCountries}"

                                                 styleClass="rich-button"

                                                 reRender="selectcountries_panel"

                                                 oncomplete="Richfaces.showModalPanel('selectcountries_panel')"/>

       

                              <!--rich:componentControl for="selectcountries_panel" attachTo="sendButton"

                                                     operation="show"

                                                     event="oncomplete"/-->

                          </td>

                      </tr>

                      </tbody>

                  </table>

       

              </a4j:region>

              </a4j:form>

       

              <rich:modalPanel id="selectcountries_panel" width="445" height="255">

       

                  <f:facet name="header">

                      <h:panelGroup>

                          <h:outputText value="#{messages.page_title_select_countries}"/>

                      </h:panelGroup>

                  </f:facet>

                  <f:facet name="controls">

                      <h:panelGroup>

                          <h:graphicImage value="/images/close_modal_panel.png" styleClass="hidelink" id="hidelink"/>

                          <rich:componentControl for="selectcountries_panel" attachTo="hidelink" operation="hide"

                                                 event="onclick"/>

                      </h:panelGroup>

                  </f:facet>

                  <a4j:form id="selectCountries_form">

       

                      <div class="label"

                           style="float: left; padding-left: 8px; width: 270px;">#{messages.label_availableCountries}</div>

                      <div class="label">#{messages.label_selectedCountries}</div>

                      <rich:pickList id="countriesShuttle"

                                     value="#{productListManager.selectedCountryCodes}"

                                     required="true"

                                     requiredMessage="#{messages.error_select_production_countries}"

                                     copyControlLabel="#{messages.label_add_selected_button_title}"

                                     copyAllControlLabel="#{messages.label_add_all_button_title}"

                                     removeControlLabel="#{messages.label_remove_selected_button_title}"

                                     removeAllControlLabel="#{messages.label_remove_all_button_title}">

                          <f:selectItems value="#{productListManager.availableCountriesSelectItems}"/>

                      </rich:pickList>

                      <table>

                          <tr>

                              <td colspan="2">

                                  <rich:message for="countriesShuttle" errorClass="errorMessage"/>

                              </td>

                          </tr>

                      </table>

                      <table width="405">

                          <tr>

                              <td> </td>

                              <td align="right" width="100%">

                                  <a4j:commandButton id="sendToCountriesButton" styleClass="rich-button"

                                                     value="#{messages.button_send_to_countries}"

                                                     action="#{productListManager.sendToCountries}"/>

                              </td>

                              <td align="right" width="100%">

                                  <a4j:commandButton id="canel_panel" styleClass="rich-button"

                                                     value="#{messages.button_cancel}">

                                      <rich:componentControl for="selectcountries_panel" attachTo="canel_panel"

                                                             operation="hide"

                                                             event="onclick"/>

                                  </a4j:commandButton>

                              </td>

                          </tr>

                      </table>

                  </a4j:form>

              </rich:modalPanel>

       

      Hi!

      if action returns null, i want to display rich:pickList. Any clue how can i fix it?Thanks.

      *My action method return facemessages or null.

        • 1. show rich:modalpanel after request
          anicapil

          if action returns null, i want to display rich:pickList but it displays rich:pickList in any case or in both cases. :-(

          • 2. show rich:modalpanel after request
            ilya40umov

            Try to use data attribute of a4j:commandButton in your oncomplete method.

            datafalsefalsejavax.el.ValueExpression
            (must evaluate to java.lang.Object)
            Serialized (on default with JSON) data passed on the client by a developer on AJAX request. It's accessible via "data.foo" syntax
            • 3. show rich:modalpanel after request
              anicapil

              thanks for the tips lIya, i solved this with java script : 

               

              <script type="text/javascript">

                             

                              function showModal(validatedForm) {

               

                                  if(validatedForm == 'true') {

                                      Richfaces.showModalPanel('selectcountries_panel');

                                  }

                              }

               

                          </script>