5 Replies Latest reply on Sep 17, 2008 8:09 AM by larry3k

    rich:modalPanel Problem

    larry3k

      Link in rich:modalPanel doesn't work. I call a rich:modalPanel, where I rerender a combobox list and when I try to submit my form it doesn't work.

      I have the following code:

      <rich:modalPanel width="290" height="200" id="presentContact" >
      ... // text
      <h:form>

      <h:selectOneMenu value="#{handler.toPresentFriendSI}">
      <f:selectItems value="#{handler.toPresentFriendsSI}" />
      </h:selectOneMenu>


      <a4j:commandLink value="present" action="#{handler.presentFriend}"/>

      <a4j:commandLink value="cancel" onclick="#{rich:component('presentContact')}.hide()"/>
      </h:form>
      </rich:modalPanel>

      The panel is called here:

      <a4j:commandLink actionListener="#{handler.getFriendsToPresent}" reRender="presentContactCombo" value="Present"
      oncomplete="#{rich:component('presentContact')}.show()">
      <f:param value="#{handler.contactId}" name="ddd" id="presContact"/>
      </a4j:commandLink>

      Here is my function from the handler:

      public void getFriendsToPresent(ActionEvent event){
      UIParameter component = (UIParameter) event.getComponent().findComponent("presContact");
      contactId = Integer.parseInt(component.getValue().toString());

      for (SNUser user : toPresentFriends) {
      if(user.getId() != friend.getId()){
      toPresentFriendsSI.add(new SelectItem(user.getId() + "", user.getForename() + " " + user.getSurname()));
      }
      }
      }

      I have a list of contacts and to each contact i can present another contact.
      The list will be generated according to the user to whom I want to present another friend,
      so for each user I have a different list and since my I have only one component I rerender each time the list.
      The list is generated as it should be, and everything looks fine but when I try to submit the function from the handler isn't called. When I don't rerender the combo my form works with no pb.


      Any ideas how I could work around this?


      Thanks

        • 1. Re: rich:modalPanel Problem
          nbelaevski

          Hello,

          Can you please add rich:messages and see if there are any?

          • 2. Re: rich:modalPanel Problem
            larry3k

            Hi,

            I put these lines of code after <h:form> in the rich:modalPanel component:

            <rich:messages passedLabel="Data is allowed to be stored." layout="list">
            <f:facet name="header">
            <h:outputText value="Entered Data Status:"></h:outputText>
            </f:facet>
            <f:facet name="passedMarker">
            <h:outputText value="passed" />
            </f:facet>
            <f:facet name="errorMarker">
            <h:outputText value="error" />
            </f:facet>
            </rich:messages>

            here are the results:

            errorpresentForm:j_id74: Validation Error: Value is not valid

            • 3. Re: rich:modalPanel Problem
              ilya_shaikovsky

              so there is nothing about modal.. your select component just throws validation error. B.t.w. why you map your selectone items and value to the same list property?

              • 4. Re: rich:modalPanel Problem
                larry3k

                there are different names. The list has an "s" toPresentFriendsSI and the value is toPresentFriendsSI without s. I have tried using my select component without rerender and it works just fine so I can't figure out where the problem is.

                • 5. Re: rich:modalPanel Problem
                  larry3k

                  sorry ... I spelled the value of the component wrong toPresentFriendSI