As follows is the code requested -- am just a newbiew JS programmer, so any 
help/advice is welcome...

<!----
PROG: SELMENU.CFM
WHAT: Javascript Mover Box logic embedded in Cold Fusion Program.
------>

<html>
<body bgcolor="#FFFFFF" link="#0000CC" vlink="#0000CC" topmargin="0" 
leftmargin="0" marginwidth="0" marginheight="0">

<script language= "JavaScript">
<!--

function one2two() {
    m1len = m1.length ;
    for ( i=0; i<m1len ; i++){
        if (m1.options[i].selected == true ) {
            m2len = m2.length;
            m2.options[m2len]= new Option(m1.options[i].text);
        }
    }

    for ( i = (m1len -1); i>=0; i--){
        if (m1.options[i].selected == true ) {
            m1.options[i] = null;
        }
    }
}

function two2one() {
    m2len = m2.length ;
        for ( i=0; i<m2len ; i++){
            if (m2.options[i].selected == true ) {
                m1len = m1.length;
                m1.options[m1len]= new Option(m2.options[i].text);
            }
        }
        for ( i=(m2len-1); i>=0; i--) {
            if (m2.options[i].selected == true ) {
                m2.options[i] = null;
            }
        }
}


function stuffvalue(){

  var mystr1 = document.theForm.mCF_VAR_IN.value
  document.theForm.mCF_VAR_OUT.value=mystr1

  var mystr2 = "hello world"
  document.theForm.hello.value=mystr2

  var mystr3 = ""
  for (i=0; i<m2.length; i++) {
      mystr3 = mystr3 + "|" + m2.options[i].value
  }
  document.theForm.result_set1.value=mystr3

}


//-->
</script>

<h2>JavaScript: Mover Box Pick List</h2>

<form  method="POST" name="theForm" ACTION="theForm.cfm" 
onsubmit="stuffvalue()" >
  <table bgcolor=white border=1 cellpadding=5 cellspacing=2 align=center >
    <tr>
      <td align=center>
          <select name=menu1 size=10 multiple>
             <option>Menu Item 1</option>
             <option>Menu Item 2</option>
             <option>Menu Item 3</option>
             <option>Menu Item 4</option>
             <option>Menu Item 5</option>
          </select><br>
          <p align=center><input type="button" onClick="one2two()" value=" >> 
"></p>

      </td>

      <td align=center>
          <select name=menu2 size=10 multiple >
          <option>Menu Item 6</option>
          </select><br>
          <p align=center><input type="button" onClick="two2one()" value=" << " 
></p>
      </td>
    </tr>
  </table>
  <BR>
 
  <INPUT TYPE="hidden" NAME="mCF_VAR_OUT" VALUE=0>
  <INPUT TYPE="hidden" NAME="hello"       VALUE=0>
  <INPUT TYPE="hidden" NAME="result_set1"    VALUE=0>

  <INPUT TYPE="TEXT"   NAME="mCF_VAR_IN"  VALUE="WHAT IS HERE">

  <table bgcolor=white border=1 cellpadding=5 cellspacing=2 align=LEFT >
    <INPUT TYPE="Submit"   NAME="Submit" VALUE="Pass Variable" >
  </TABLE>

</form>

<!-- zubburn look here. This is where the extra bit of code goes -->
<script language="JavaScript">
<!--
// shorthand for refering to menus
// must run after document has been created
// you can also change the name of the select menus and
// you would only need to change them in one spot, here
  var m1 = document.theForm.menu1;
  var m2 = document.theForm.menu2;
-->
</script>

</body>
</html>

<!---------------
PROG: THEFORM.CFM
WHAT: Action form called by SELMENU.CFM
----------------->
got to theForm.cfm<br>
<cfoutput>
mCF_VAR_OUT = #mCF_VAR_OUT#<br>
hello = #hello#<br>
selected_list = #result_set1#
<BR>
</cfoutput>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:184507
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to