[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

COldFusion form submit

Posted on 2009-02-09
11
Medium Priority
?
874 Views
Last Modified: 2013-12-24
I am building the report in coldfusion using table. And i have i column called completion which is the checkbox field. Actually this cell is the form itself. What I need to do is to setup the way so when somebody click on that cell it will update the database without refreshing  the report itself

Please help
<td valign="top" align="center">
							<form name="frm" method="post" action="" id="frm">
								<input type="checkbox" name="chk#Employeeid#" value="#getCapstone.isAccept#" onClick="javascript:chkSubmit ();" <cfif getCapstone.isAccept eq 1>checked</cfif>>
							</form>
							<cfif isDefined("form.chk")>
				
								<cfquery name="qryUpdate" datasource="cfelsunrise">
									Update EDITCapstone set isAccept = <cfif getCapstone.isAccept eq 1><cfqueryparam cfsqltype="cf_sql_integer" value="0"><cfelse><cfqueryparam cfsqltype="cf_sql_integer" value="1"></cfif> where EmpID = #EmployeeID#
								</cfquery>
							</cfif>
						</td>

Open in new window

0
Comment
Question by:erikTsomik
  • 6
  • 5
11 Comments
 
LVL 13

Accepted Solution

by:
srikanthmadishetti earned 750 total points
ID: 23592280


Use ColdFusion.Ajax.submitForm
<td valign="top" align="center">
       <form name="frm" method="post" action="" id="frm">
        <input type="checkbox" name="chk#Employeeid#" value="#getCapstone.isAccept#" onClick="javascript:chkSubmit ();" <cfif getCapstone.isAccept eq 1>checked</cfif>>
       </form>
       
      </td>

<script>
function chkSubmit(){
ColdFusion.Ajax.submitForm('frm','test.cfm',resultHandler);
}
 function resultHandler(result) ()
{
}
</script>

in test .cfm

put this code
<cfif isDefined("form.chk")>
   
        <cfquery name="qryUpdate" datasource="cfelsunrise">
         Update EDITCapstone set isAccept = <cfif getCapstone.isAccept eq 1><cfqueryparam cfsqltype="cf_sql_integer" value="0"><cfelse><cfqueryparam cfsqltype="cf_sql_integer" value="1"></cfif> where EmpID = #EmployeeID#
        </cfquery>
       </cfif>
       
       using codlfusion.ajax.submitform you can submit to a cfc too.
0
 
LVL 13

Expert Comment

by:srikanthmadishetti
ID: 23592311
i am just confued with the query u have but the thing when u submit your form using coldfusion.ajax.submitform it will submit with our page refresh to the mentioned cfc or page.
 
 
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 23592492
all i want to refresh is that particular column of the report
0
Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

 
LVL 19

Author Comment

by:erikTsomik
ID: 23592599
when I execute the code i get an error
ColdFusion is Undefined. Is there something that i need to import first
0
 
LVL 13

Expert Comment

by:srikanthmadishetti
ID: 23592786
you have coldfusion 8 right
0
 
LVL 13

Expert Comment

by:srikanthmadishetti
ID: 23592804
coldfusion 8 and and when u instal coldfusion 8 u will get this folders
 
C:\Inetpub\wwwroot\CFIDE\scripts\ajax
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 23592838
I can not Update the mapping to this path . Is there other way to import this library
0
 
LVL 13

Expert Comment

by:srikanthmadishetti
ID: 23592882
u have cfide mapped in your iis
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 23592901
yes . It mapped to /cfide
0
 
LVL 13

Expert Comment

by:srikanthmadishetti
ID: 23593139
if coldfusion 8 in your root folder u should have CFIDE\scripts\ajax folder with js files
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 23594197
OK . I lnkied to this folder now i get error saying that cfmessage is undefined
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Integration Management Part 2
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question