[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

I need a javascript button to move data from one table to another

Asked by Cashmgmt in JavaScript, ColdFusion Application Server, Microsoft IIS Web Server

I currently have a submit button that will move a field or all fields from the table on the left to the table on the right.  I need to replace it with a javascript function.  this is my javascript function:

            function custRpt()
            {
              document.Form1.action = 'custRpt.cfm';
              document.Form1.submit();
            }

I have attached a copy of the cfm page.  When I click on a field and click on the javascript link I created nothing happens.  Same when I click the add all button.  I'm new to this so I'm not sure what I'm doing wrong.  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
<script language="javascript" src="inc/dcd.js"></script>
<link href="https://www.sovereignbank.com/inc/all.css" rel="stylesheet" type="text/css">
<style type="text/css"></style>
 
<cfset #pageTitle# = "Administration">
<cfset #curPage# = 77>
<cfset #custContent# = "AP1">
 
<cfset #LbxName# = RemoveChars(#session.lbxformattable#,1,8)>
<!---<cfif #Session.lbxtype# is "Wholesale">--->
<cfset #RptTableName# = "lbx_rpt_#LbxName#">
<!---<cfelse>
<cfset #RptTableName# = "rlb_rpt_#LbxName#">
</cfif>--->
 
<cfquery name = "checkforrpttable" datasource="#Application.dsname#">
  SELECT * from sysobjects where name = '#RptTableName#'
</cfquery>
 
<cfif #checkforrpttable.Recordcount# is 0>
  <cfquery name = "createrpttable" datasource = "#Application.dsname#">
     SELECT * INTO #RptTableName# FROM #SESSION.LBXFORMATTABLE#
  </cfquery>
<cfelse>
  <cfquery name = "comparefmt" datasource = "#Application.dsname#">
      SELECT * FROM #Session.LbxFormatTable# T1 
	        WHERE (T1.layout = 'AP') AND 
			NOT EXISTS(SELECT * FROM #RptTableName# T2 where (T1.fld_order = T2.fld_order) and layout='AP')
  </cfquery>
  <cfif #comparefmt.RecordCount# gt 0>
     <cfquery name = "insertintoReportTable" datasource = "#Application.dsname#">
	     INSERT INTO #RptTableName#(layout,fld_order,fld_name,fld_otype,fld_len,fld_dec,fld_prompt,fld_head1,fld_head2,can_modify,can_search,at_info,at_caption,at_trans,at_chkbody,at_invbody,at_cpnbody,at_support,at_report,rollup,total)
    	   (SELECT * FROM 
			    #Session.LbxFormatTable# T1 
				WHERE (T1.layout = 'AP') AND 
				NOT EXISTS(SELECT * FROM #RptTableName# T2 where (T1.fld_order = T2.fld_order) and layout='AP'))
	 </cfquery>
  <cfelse>
	  <cfquery name = "comparerpt" datasource = "#Application.dsname#">
    	  SELECT * FROM #RptTableName# T1 
	    	    WHERE (T1.layout = 'AP') AND 
				NOT EXISTS(SELECT * FROM #Session.LbxFormatTable# T2 where (T1.fld_order = T2.fld_order)and layout='AP')
	  </cfquery>
 
  	<cfif #comparerpt.RecordCount# gt 0>
    	<cfloop query = "comparerpt">
		<cfquery name="Del" datasource="#Application.dsname#">
	   		DELETE  FROM #RPTTableName# where (fld_order = #comparerpt.fld_order#) and (layout = 'AP')
		</cfquery>
		</cfloop>
	</cfif>
  </cfif>
  
  <cfquery name ="checkforcan_search" datasource="#Application.dsname#">
     SELECT T2.fld_name,T2.layout,T2.fld_order,T2.can_search FROM #RptTableName# T1,#Session.lbxFormatTable# T2 WHERE 
	    (T1.layout = T2.layout) And (T1.layout = 'AP') AND
		(T2.can_search <> T1.can_search) AND (T1.fld_name = T2.fld_name) 
		ORDER BY T1.fld_order
  </cfquery>
  
  <cfif #checkforcan_search.RecordCount# gt 0>
    <cfloop query = "checkforcan_search">
	
   <cfquery name = "updaterpttable" datasource= "#Application.dsname#">
            UPDATE #RptTableName#  SET can_search = #checkforcan_search.can_search#
                 WHERE (layout = 'AP') AND
     		           (fld_name = '#checkforcan_search.fld_name#')
	</cfquery>
	</cfloop>
  </cfif>
</cfif>
 
 
<cfif #ParameterExists(form.add)# AND #Len(Trim(form.add))# gt 0>
<!--- added isDefine to make sure form.flds exist --->
<cfif isdefined("form.Flds")>
  <cfset #form.reportFields#="#form.reportFields#,#form.flds#">
</cfif>
 </cfif>
<cfif #ParameterExists(form.addAll)# AND #Len(Trim(form.addAll))# gt 0>
  <cfquery name="getAll" datasource="#Application.dsname#">
    <!---SELECT fld_name, layout, can_search FROM #session.lbxformattable# WHERE layout='AP' AND can_search=1--->
	SELECT fld_name, layout, can_search FROM #RptTableName# WHERE layout='AP' AND can_search=1
  </cfquery>
  <cfset #lcv# = 1>
  <cfloop query="getAll">
    <cfquery name="updateAll" datasource="#Application.dsname#">
      <!---UPDATE #session.lbxformattable# SET at_report=#lcv# WHERE layout='AP' AND fld_name='#getAll.fld_name#'--->
	  UPDATE #RptTableName# SET at_report=#lcv# WHERE layout='AP' AND fld_name='#getAll.fld_name#'
    </cfquery>
    <cfset #lcv# = #lcv# + 1>
  </cfloop>
</cfif>
 
<cfif #ParameterExists(form.remove)# AND #Len(Trim(form.remove))# gt 0>
<!--- added isDefine to make sure form.rptflds exist --->
<cfif isdefined("form.rptFlds")>
  <cfset #tmpList# = #form.reportFields#>
  <cfset #tmpFindVal# = #ListFindNoCase(tmpList, form.rptFlds, ",")#>
  <cfif #tmpFindVal# gt 0>
    <cfset #form.reportFields# = #ListDeleteAt(tmpList, tmpFindVal, ",")#>
    <cfquery name="remove" datasource="#Application.dsname#">
      <!---UPDATE #session.lbxformattable# SET at_report=0 WHERE layout='AP'--->
	  UPDATE #RptTableName# SET at_report=0 WHERE layout='AP'
    </cfquery>
	 </cfif> 		
  </cfif>
</cfif>
 
<cfif #ParameterExists(form.removeAll)# AND #Len(Trim(form.removeAll))# gt 0>
  <cfset #form.reportFields# = "">
  <cfquery name="removeAll" datasource="#Application.dsname#">
    <!---UPDATE #session.lbxformattable# SET at_report=0 WHERE layout='AP'--->
	UPDATE #RptTableName# SET at_report=0 WHERE layout='AP'
  </cfquery>
</cfif>
 
<cfif (#ParameterExists(form.finished)# AND #Len(Trim(form.finished))# gt 0) OR
      (#ParameterExists(form.add)# AND #Len(Trim(form.add))# gt 0) OR
      (#ParameterExists(form.remove)# AND #Len(Trim(form.remove))# gt 0) OR
      (#ParameterExists(form.removeAll)# AND #Len(Trim(form.removeAll))# gt 0)>
 
  <cfset #lcv# = 0>
  <cfloop index="fldName" list="#form.reportFields#">
    <cfoutput>
      <cfset #lcv# = #lcv# + 1>
      <cfquery name="addRptFields" datasource="#application.dsname#">
        <!---UPDATE #session.lbxformattable# SET at_report=#lcv# WHERE fld_name='#fldName#' AND layout='AP'--->
		UPDATE #RptTableName# SET at_report=#lcv# WHERE fld_name='#fldName#' AND layout='AP'
      </cfquery>
    </cfoutput>
  </cfloop>
</cfif>
 
<cfif #ParameterExists(form.finished)# AND #Len(Trim(form.finished))# gt 0>
  <cfif #ParameterExists(form.reportFields)# AND #Len(Trim(form.reportFields))# gt 0>
    <cfset #tmpUrl# = "custRpt.cfm?errMsg=Custom%20report%20updated">
  <cfelse>
    <cfset #tmpUrl# = "custRpt.cfm?errMsg=Unable%20to%20update%20custom%20report">
  </cfif>
  <cflocation url="#tmpUrl#">
<cfelse>
  <cfinclude template="intra-main2.cfm">
 
  <cfquery name="getMaxFields" datasource="#Application.dsname#">
    <!---SELECT fld_name, layout, can_search FROM #session.lbxformattable# WHERE layout='AP' AND can_search=1--->
	SELECT fld_name, layout, can_search FROM #RptTableName# WHERE layout='AP' AND can_search=1
  </cfquery>
 
  <cfquery name="getFields" datasource="#application.dsname#">
    <!---SELECT * FROM #session.lbxformattable# WHERE layout='AP' and can_search=1 AND at_report=0 ORDER BY fld_name--->
	SELECT * FROM #RptTableName# WHERE layout='AP' and can_search=1 AND at_report=0 ORDER BY fld_name
  </cfquery>
 
  <cfquery name="getRptFields" datasource="#application.dsname#">
    <!---SELECT * FROM #session.lbxformattable# WHERE layout='AP' and at_report>0 ORDER BY at_report--->
	SELECT * FROM #RptTableName# WHERE layout='AP' and at_report>0 ORDER BY at_report
  </cfquery>
 
  <p><br></p>
  <cfif #ParameterExists(URL.errMsg)# AND #Len(Trim(URL.errMsg))# gt 0>
    <p><div align="center"><font color="#Application.emphtext#"><b><cfoutput>#URL.errMsg#</cfoutput></b></font></div></p>
  </cfif>
  <p><br></p>
 
  <CFSET tmpReportFields = #ValueList(getRptFields.fld_name)#>
 
  <table style="border:1px solid #d1cdc6; margin-left:10px;">
    <form name="Form1" method="post" action="custRpt.cfm">
      <input type="hidden" name="reportFields" value="<cfoutput>#tmpReportFields#</cfoutput>">
      <tr>
        <td><font size="-2"><b>Available Fields:</b></font></td>
        <td>&nbsp;</td>
        <td><font size="-2"><b>Selected Fields:</b></font></td>
      </tr>
      <tr>
        <td valign="top" bordercolor="#d1cdc6">
          <select name="flds" size="<cfoutput>#getMaxFields.RecordCount#</cfoutput>">
            <cfif #getFields.RecordCount# is 0>
              <option value="">-- All Selected --</option>
            <cfelse>
              <cfoutput query="getFields">
                <option value="#getFields.fld_name#">#getFields.fld_head1#&nbsp;#getFields.fld_head2#</option>
              </cfoutput>
            </cfif>
          </select>
        </td>
        <td valign="top">
		  <a href="javascript:document.Form1.submit()" class="red10"><img src="images/double_arrow1_left.gif" border="0">&nbsp;Remove</a>		
          <p><input type="submit" class="red10" name="add" value="      >     "></p>
		  <a href="javascript: custRpt()" class="red10"><img src="images/double_arrow1_left.gif" border="0">&nbsp;Remove All</a>		
          <p><input type="submit" class="red10" name="addAll" value="    >>    "></p>
		  <a href="javascript: custRpt()" class="red10">Add&nbsp;<img src="images/double_arrow.gif" border="0"></a>		
          <p><input type="submit" class="red10" name="remove" value="     <      "></p>
		  <a href="javascript: custRpt()" class="red10">Add All&nbsp;<img src="images/double_arrow.gif" border="0"></a>		
          <p><input type="submit" class="red10" name="removeall" value="    <<    "></p>
        </td>
        <td valign="top" bordercolor="#d1cdc6">
          <select name="rptFlds" size="<cfoutput>#getMaxFields.RecordCount#</cfoutput>">
            <cfif #getRptFields.RecordCount# is 0>
              <option value="">-- None Selected --</option>
            <cfelse>
              <cfoutput query="getRptFields">
                <option value="#getRptFields.fld_name#">#getRptFields.fld_head1#&nbsp;#getRptFields.fld_head2#</option>
              </cfoutput>
            </cfif>
          </select>
        </td>
      </tr>
    </form>
  </table>
  <p><br /></p>
  <cfinclude template="footer.cfm">
</cfif>
[+][-]01/29/08 03:37 PM, ID: 20773483Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: JavaScript, ColdFusion Application Server, Microsoft IIS Web Server
Sign Up Now!
Solution Provided By: Mr_Nil
Participating Experts: 1
Solution Grade: A
 
[+][-]01/29/08 02:26 PM, ID: 20773003Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/29/08 02:37 PM, ID: 20773090Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/29/08 03:05 PM, ID: 20773298Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 / EE_QW_2_20070628