troubleshooting Question

Submit FORM or LINK with cfajax JavaScript

Avatar of Qsorb
QsorbFlag for United States of America asked on
JavaScriptWeb ServersColdFusion LanguageAJAX
10 Comments1 Solution850 ViewsLast Modified:
myCB = function(resp){
var msgDiv = document.getElementById('messages');
msgDiv.innerHTML = resp;

myError = function(sc,msg){
alert('Error!!! ' +sc +' '+msg);

submitFrm = function(){
	ColdFusion.Ajax.submitForm('testForm', 'update.cfm', myCB, myError);

<style type="text/css">
.delbtn {
	background: url("/a/delbtn-x.png") no-repeat;
	font-weight: bold; text-decoration: none; display: block;

.delbtn:hover {
	background: url("/a/delbtn.png") no-repeat;

<!--- class delbtn displays an image which I want to keep --->

<!--- I perfer using a table and link with the message showing but cannot get the JavaScript to work with it. 
Is the problem the JavaScript name, code, what? --->
  <td class="delbtn" id="testForm"><div id="messages">&nbsp;</div></td>

<!-- I prefer NOT to use a form because I have trouble getting the DIV ID message inside the FORM Value as well as the class delbtn --->
<div class="delbtn" id="messages">&nbsp;</div>
<form name="testForm" id="testForm" action="/purchase/add-to-cart.cfm" method="post">
  <input name="messages" id="messages" class="delbtn" type="button" value=" "  onclick="javascript:submitFrm();"  />        

Need help finding a way to submit an anchor LINK or FORM so my JavaScript message will display correctly and at the correct place without having to resort to using css absolute positioning.

 My test code needs to go inside a table which I cannot figure out how to display the message correctly.

If I could get the form to display the info inside the VALUE, including the image of class=delbtn, as well as the JavaScript message, then I could use the form. But attempting this in every way I can imaging, does not work.

Hopefully, there's something very basically wrong I'm just not seeing.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros