0 Replies Latest reply on Aug 27, 2007 5:02 PM by Joe Greene

    using a4j:actionparam or a4j:jsFunction

    Joe Greene Novice

      I need to send x,y coordinates from drop event back to the server. Thanks to another user, I've been able to do this using a4j:actionparam. Here is my dropSupport code as it stands now:

      <rich:dropSupport acceptedTypes="genItem" dropValue="event.clientX"
      dropListener="#{dragDropBean.processDrop}" reRender="map">
       <a4j:actionparam value="event.clientX" noEscape="true" assignTo="#{dragDropBean.x}" />
       <a4j:actionparam value="event.clientY" noEscape="true" assignTo="#{dragDropBean.y}" />
      </rich:dropSupport>
      


      However, there are two problems:

      1. The bean values for x and y get updated one drop too late - i.e., on the first drop anywhere in my drop zone, the bean x,y is reported as 0,0 (the initial values of my ints). On the next drop, the bean reports the x,y of the first drop, and so on...

      2. Obviously, the "value" attribute in a4j:actionparam takes a string, but what are its limitations. "event.clientX" and "event.clientY" do not take into account the scrolling position of the page for IE. How would I get the cross-browser correct page offsets back to the server for both IE and Firefox, for example? Maybe I could do it with a4j:jsFunction, but I can't tell how to do this in a cross-browser way. Maybe there's a better example that I have not seen.

      Maybe I'm missing something on point #2 - any help would be appreciated. Thanks.