6 Replies Latest reply on Jun 10, 2013 12:29 PM by amittikoo84

    drag-drop fails in RF4.2-Final

    milovdzee

      Hello,

       

      since I upgraded to RF4.2/Myfaces-2.1.6 my drag-drop stopped functioning. I now get a firebug message saying: "Sourceform could not be determined, either because element is not attached to a form or we have multiple forms with named elements of the same identifier or name, stopping the ajax processing" or in Dutch "De doel form kon niet bepaald worden, ofwel omdat het element niet tot een form behoort, ofwel omdat er verschillende forms zijn met 'named element' met dezelfde identifier of naam, ajax verwerking is gestopt.".

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html

          xmlns="http://www.w3.org/1999/xhtml"

          xmlns:h="http://java.sun.com/jsf/html"

          xmlns:f="http://java.sun.com/jsf/core"

          xmlns:a4j="http://richfaces.org/a4j"

          xmlns:ui="http://java.sun.com/jsf/facelets"

          xmlns:rich="http://richfaces.org/rich"

          xmlns:fn="http://java.sun.com/jsp/jstl/functions"

          xmlns:c="http://java.sun.com/jsp/jstl/core"

      >

       

      <h:head>

      </h:head>

       

      <h:body>

          <rich:dragIndicator id="indicator" acceptClass="accept" rejectClass="reject" draggingClass="default">

              <h:graphicImage id="mailDragIcon" url="/images/mail_h20px.png" alt="Sleep bericht" title="Sleep bericht"/>

          </rich:dragIndicator>

       

          <a4j:log id="log" level="INFO" mode="popup" hotkey="M"/> <!-- Ctrl+Shift+M -->

       

          <h:form id="formId">

              <a4j:outputPanel layout="block" style="border: 1px solid red; width: 200px; height: 50px;" styleClass="rf-ind-drag">

                  <rich:dragSource id="dragSource" dragIndicator="indicator" type="type1" dragValue="#{message.id}"/>

                  <h:outputText value="dragSource"/>

              </a4j:outputPanel>

       

              <a4j:outputPanel layout="block" style="border: 1px solid red; width: 200px; height: 50px;">

                  <rich:dropTarget id="dragTarget1" acceptedTypes="type1" dropListener="#{messageFolderManager.dropMessage}"/>

                  <h:outputText value="dropTarget"/>

              </a4j:outputPanel>

       

              <a4j:outputPanel layout="block" style="border: 1px solid red; width: 200px; height: 50px;">

                  <rich:dropTarget id="dragTarget2" acceptedTypes="type2" dropListener="#{messageFolderManager.dropMessage}"/>

                  <h:outputText value="dropTarget"/>

              </a4j:outputPanel>

          </h:form>

      </h:body>

       

      </html>

       

      What am I doing wrong?

       

      Thanks,

      Milo

        • 1. Re: drag-drop fails in RF4.2-Final
          milovdzee

          It works under Mojarra 2.1.7 and so I assume an incompatibility between RF4.2 and MyFaces 2.1.6.

          • 2. Re: drag-drop fails in RF4.2-Final
            milovdzee

            Not fixed in richfaces 4.2.1-20120229.011144-4

            • 3. Re: drag-drop fails in RF4.2-Final
              primo86

              I have the same problem. Drag and drop not working under RF4.2 and Myfaces 2.1.6 and 2.1.7.

              • 4. Re: drag-drop fails in RF4.2-Final
                milovdzee

                I switched to jQuery and now at least I have drag-and-drop.

                 

                Code example:

                 

                <div id="sentDatePanel" data-messageid="#{data.id}" class="makeDraggable HoverHand #{messageManager.selectedMessage.id==data.id?'Current':''} #{data.read?'':'messageNotRead'}">

                  <h:outputText value="#{data.sentDate}" converter="CalendarDateTimeConverter"/>

                </div>

                 

                <div id="folderName" data-folderid="#{messageFolderManager.messageFolder.id}" class="makeDroppable HoverHand #{messageManager.selectedMessageFolder.id==messageFolderManager.messageFolder.id?'Current':''}">

                  <h:outputText escape="false" value="#{messageFolderManager.indention}"/>

                  #{messageFolderManager.messageFolder.name}

                </div>

                 

                <a4j:outputPanel id="jqPanel" ajaxRendered="true">       

                  <rich:jQuery id="makeDrag" selector=".makeDraggable" query="draggable({helper: dragHelper, appendTo: 'body', cursorAt: { left: 15, top: 10 }})"/>

                  <rich:jQuery id="makeDrop" selector=".makeDroppable" query="droppable({hoverClass:'drophover', drop: drop})"/>

                </a4j:outputPanel>

                 

                function dragHelper() {

                  var content = '<img src="/images/mail_h20px.png"/>';

                  return content;

                }

                 

                function drop(event, ui) {

                  var draggable = ui.draggable;

                  var messageId = draggable.data('messageid');

                 

                  var droppable = jQuery(this);

                  var folderId = droppable.data('folderid');

                 

                  dropMessage(messageId, folderId);

                }

                 

                MAG,

                Milo van der Zee

                • 5. Re: drag-drop fails in RF4.2-Final
                  primo86

                  Not fixed in richfaces 4.3.0.Milestone1.

                  I have read in the announcement that this version focuses on improve MyFaces support.

                   

                  Do you plan to fix this problem  in 4.3.0 Final?

                  • 6. Re: drag-drop fails in RF4.2-Final
                    amittikoo84

                    We were facing the same issue. THe workaround is to remove the ric:dragIndicator. Then it will work with MyFaces.