Loading ...
Sorry, an error occurred while loading the content.

Capture in a form the results from Drag and Drop to Reorder a List

Expand Messages
  • john_bell_sas
    I m working with the example of a drag and drop to reorder a list. I m trying to capture the results in a form to send to the server. The example uses the
    Message 1 of 3 , Mar 2, 2008
    View Source
    • 0 Attachment
      I'm working with the example of a drag and drop to reorder a list.
      I'm trying to capture the results in a form to send to the server.
      The example uses the showorder function which works well to display
      the order. It seems like it should be easy to capture into a hidden
      form, but nothing I try seems to work. Has anyone modified this
      example to do this?


      Thanks,

      John
    • john_bell_sas
      ... This is the code I m trying:
      Message 2 of 3 , Mar 3, 2008
      View Source
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "john_bell_sas" <john.bell@...>
        wrote:
        >
        > I'm working with the example of a drag and drop to reorder a list.
        > I'm trying to capture the results in a form to send to the server.
        > The example uses the showorder function which works well to display
        > the order. It seems like it should be easy to capture into a hidden
        > form, but nothing I try seems to work. Has anyone modified this
        > example to do this?
        >
        >
        > Thanks,
        >
        > John
        >

        This is the code I'm trying:

        <FORM ACTION="http://risksupport1:9080/SASStoredProcess/do?_program="
        method=get >
        <input type="hidden" name="_program"
        value="SBIP://Foundation/Samples/Stored Processes/cc_test(StoredProcess)">
        <input type="hidden" name=reqtype value="report">
        <script type="text/javascript">
        var parseList = function(ul, title) {
        var items = ul.getElementsByTagName("li");
        var out = title + ": ";
        for (i=0;i<items.length;i=i+1) {
        out += items[i].id + " ";
        }
        return out;
        };

        var ul1=Dom.get("ul1"), ul2=Dom.get("ul2");
        alert(parseList(ul1, "List 1") + "\n" + parseList(ul2, "List 2"));

        document.write("The Value: <input type='hidden' name='test'
        value='"+out+"' />");
        </script>


        <input type="submit" value="Run Ghost Portfolio" >
        </form>
        </div>
      • john_bell_sas
        ... Processes/cc_test(StoredProcess) ... 2 )); ... If anyone has a similar problem - This is what finally worked:
        Message 3 of 3 , Mar 3, 2008
        View Source
        • 0 Attachment
          --- In ydn-javascript@yahoogroups.com, "john_bell_sas" <john.bell@...>
          wrote:
          >
          > --- In ydn-javascript@yahoogroups.com, "john_bell_sas" <john.bell@>
          > wrote:
          > >
          > > I'm working with the example of a drag and drop to reorder a list.
          > > I'm trying to capture the results in a form to send to the server.
          > > The example uses the showorder function which works well to display
          > > the order. It seems like it should be easy to capture into a hidden
          > > form, but nothing I try seems to work. Has anyone modified this
          > > example to do this?
          > >
          > >
          > > Thanks,
          > >
          > > John
          > >
          >
          > This is the code I'm trying:
          >
          > <FORM ACTION="http://risksupport1:9080/SASStoredProcess/do?_program="
          > method=get >
          > <input type="hidden" name="_program"
          > value="SBIP://Foundation/Samples/Stored
          Processes/cc_test(StoredProcess)">
          > <input type="hidden" name=reqtype value="report">
          > <script type="text/javascript">
          > var parseList = function(ul, title) {
          > var items = ul.getElementsByTagName("li");
          > var out = title + ": ";
          > for (i=0;i<items.length;i=i+1) {
          > out += items[i].id + " ";
          > }
          > return out;
          > };
          >
          > var ul1=Dom.get("ul1"), ul2=Dom.get("ul2");
          > alert(parseList(ul1, "List 1") + "\n" + parseList(ul2, "List
          2"));
          >
          > document.write("The Value: <input type='hidden' name='test'
          > value='"+out+"' />");
          > </script>
          >
          >
          > <input type="submit" value="Run Ghost Portfolio" >
          > </form>
          > </div>
          >
          If anyone has a similar problem - This is what finally worked:


          <div id="user_actions">
          <FORM
          ACTION="http://risksupport1:9080/SASStoredProcess/do?_program=SBIP://Foundation/Samples/Stored
          Processes/cc_test(StoredProcess)" method=post name="test">
          <input type="hidden" name="_program"
          value="SBIP://Foundation/Samples/Stored Processes/cc_test(StoredProcess)">
          <input type="hidden" name=reqtype value="report">
          <input type="hidden" name="fields" >
          <!--<input type="button" id="showButton" value="Show Current Order" > -->
          <input type='submit' id="showButton" value='Run Ghost Portfolio' >
          </form>
          </div>
          With a modified:

          showOrder: function() {
          var parseList = function(ul, title) {
          var items = ul.getElementsByTagName("li");
          var out = title + ": ";
          for (i=0;i<items.length;i=i+1) {
          out += items[i].id + " ";
          }
          return out;
          };

          var ul1=Dom.get("ul1"), ul2=Dom.get("ul2");
          document.getElementById("fields").value = parseList(ul2, "List 2")
          // <!-- alert(parseList(ul1, "List 1") + "\n" + parseList(ul2,
          "List 2")); -->//
        Your message has been successfully submitted and would be delivered to recipients shortly.