Drag and drop in different forms drag value always null - 3.
samtherecordman May 23, 2008 5:28 AMDrag and drop when the drag/drop tags are in different forms always results in drag value is null in processDrop() method.
Test case
-------------
The code below has two drag and drop areas.
1. Drag [Drag me A] onto [Drop zone A] and drag value is always null. The drag zone is in a different form to the drop zone.
INFO: org.richfaces.event.DropEvent[source=org.richfaces.component.html.HtmlDropSupport@13ed2fc]
May 23, 2008 10:25:22 AM dashboard.Test processDrop
INFO: drag value null
May 23, 2008 10:25:22 AM dashboard.Test processDrop
INFO: drop value bar
2. Drag [Drag me B] onto [Drop zone B] and drag value is correct. The zones are in a single form.
INFO: org.richfaces.event.DropEvent[source=org.richfaces.component.html.HtmlDropSupport@bc9d1a]
May 23, 2008 10:26:16 AM dashboard.Test processDrop
INFO: drag value foo
May 23, 2008 10:26:16 AM dashboard.Test processDrop
INFO: drop value bar
This looks like a bug. Regards
Sam Elstob
Triometric
Test.java
package dashboard;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.event.DropEvent;
import org.richfaces.event.DropListener;
public class Test implements DropListener
{
private Log log = LogFactory.getLog(Dashboard.class);
@Override
public void processDrop(DropEvent event)
{
// TODO Auto-generated method stub
log.info(event);
log.info("drag value " + event.getDragValue());
log.info("drop value " + event.getDropValue());
}
}
test.jsp
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:view>
<rich:dragIndicator id="drag_indicator_1">
</rich:dragIndicator>
<h:form id="drag_form">
<a4j:outputPanel>
<h:outputText value="Drag me (A)" />
<rich:dragSupport dragType="drag_type_1" dragValue="foo" dragIndicator="drag_indicator_1">
</rich:dragSupport>
</a4j:outputPanel>
</h:form>
<h:form id="drop_form">
<rich:panel style="height: 200px; width: 200px">
<h:outputText value="Drop zone A" />
<rich:dropSupport acceptedTypes="drag_type_1"
dropListener="#{test.processDrop}" dropValue="bar">
</rich:dropSupport>
</rich:panel>
</h:form>
<h:form id="single_form">
<a4j:outputPanel>
<h:outputText value="Drag me (B)" />
<rich:dragSupport dragType="drag_type_1" dragValue="foo" dragIndicator="drag_indicator_1">
</rich:dragSupport>
</a4j:outputPanel>
<rich:panel style="height: 200px; width: 200px">
<h:outputText value="Drop zone B" />
<rich:dropSupport acceptedTypes="drag_type_1"
dropListener="#{test.processDrop}" dropValue="bar">
</rich:dropSupport>
</rich:panel>
</h:form>
<%-- --%>
<%-- --%>
<%-- Debugging panels below here--%>
<!-- a4j debug log -->
<a4j:outputPanel layout="block" rendered="true" id="panel_debug">
<rich:simpleTogglePanel switchType="client" label="a4j debug log"
opened="false" id="panel_debug_a4j">
<a4j:log popup="false" level="ALL" style="width: 800px; height: 300px;" />
</rich:simpleTogglePanel>
</a4j:outputPanel>
</f:view>