4 Replies Latest reply on Sep 8, 2009 7:07 PM by venuvanama

    rich modal window issue

    venuvanama Newbie

      Hi,

      We are using rich faces 3.3.0, we are using rich modal window component for popups to perform lookups, on rich modal windows if the user hits on return after entering search criteria, modal window is closed and the parent form is submitted. Is there anyway to fix this problem, when the user hits return can we simulate click on search button to perform the search and not submit the parent form.

      Here is a sample of my code:

      <f:subview id="domainSearchModalPanelSubview" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
      <a4j:region selfRendered="true">
      <rich:modalPanel id="domainSearchModalPanel" height="175" width="400">
      <f:facet name="header">
      <h:outputText value="Domain Search"/>
      </f:facet>
      <f:facet name="controls">
      <h:graphicImage value="/images/close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('domainSearchModalPanel')" />
      </f:facet>
      <a4j:form id="domainSearchForm">
      <rich:spacer height="35px" />
      <a4j:status >
      <f:facet name="start">
      <h:graphicImage value="/images/loading.gif" />
      </f:facet>
      </a4j:status>
      <h:panelGrid id="domainNamePatternPanelGrid" columns="3" styleClass="detail" columnClasses="label">
      <h:outputLabel for="domainNamePattern">
      <h:outputText value="Name Pattern" />
      </h:outputLabel>
      <h:inputText id="domainNamePattern"
      binding="#{domainSearchBean.domainNamePatternInputText}"
      value="#{domainSearchBean.domainNamePattern}" />
      <a4j:commandButton
      id="searchButton" value="Search" action="#{domainSearchBean.onDomainSearch}"
      reRender="domainSearchResultPanelGrid" />
      </h:panelGrid>
      <h:panelGrid id="domainSearchResultPanelGrid" columns="2" styleClass="detail" columnClasses="label">
      <h:outputLabel for="domainName">
      <h:outputText value="Domain" />
      </h:outputLabel>
      <h:selectOneMenu id="domainName" binding="#{domainSearchBean.domainNameSelectOneMenu}" value="#{domainSearchBean.domainName}">
      <f:selectItem id="defaultDomainNameSelectItem" itemLabel="" />
      <f:selectItems id="domainNameSelectItems" value="#{domainSearchBean.domainNameSuggestions}" />
      </h:selectOneMenu>
      </h:panelGrid>
      <a4j:commandButton id="domainSearchOkButton" value="OK" action="#{domainSearchBean.onDomainSearchOk}" reRender="domainNamePanelGrid,domainNamePanelGrid2,domainNamePanelGrid3,domainNamePanelGrid4">
      <rich:componentControl for="domainSearchModalPanel" event="onclick" disableDefault="true" operation="hide">
      <f:param name="hide" value="componentControl work(hide)"/>
      </rich:componentControl>
      </a4j:commandButton>
      <a4j:commandButton id="domainSearchCancelButton" value="Cancel" action="#{domainSearchBean.onDomainSearchCancel}" reRender="domainNamePanelGrid,domainNamePanelGrid2,domainNamePanelGrid3,domainNamePanelGrid4">
      <rich:componentControl for="domainSearchModalPanel" event="onclick" disableDefault="true" operation="hide">
      <f:param name="hide" value="componentControl work(hide)"/>
      </rich:componentControl>
      </a4j:commandButton>
      </a4j:form>
      </rich:modalPanel>
      </a4j:region>
      </f:subview>

      Thanks for your help.

      Venu