Question
Help me get over a huge hurdle
If I could just understand how this works, I think I would
get over a huge hurdle. My development background is not web based
and I'm having difficulty making the jump from desktop apps.
Here is the hurdle...
I have a button on a form. When the user clicks the button, I would like to perform an SQL statement. I don't want to submit the form. I just want a few lines of code to execute. Both the button and Function reside in the same page of code.
Here is the button...
<td><input name="AddToCart" type="button" id="AddToCart" onclick="cmdAddToCart()" value="Add to Cart" /></td>
and here is the function I am trying to call on the onclick event.
<%
function cmdAddToCart()
{
var cmdAddToCart = Server.CreateObject("ADODB.Command")
cmdAddToCart.ActiveConnection = MM_connMTPJava_STRING
cmdAddToCart.CommandText = "INSERT INTO Orders (Type ) VALUES ('"+ cmdAddToCart__varType.replace(/'/g, "''") + "' ) "
cmdAddToCart.CommandType = 1
cmdAddToCart.CommandTimeout = 0
cmdAddToCart.Prepared = true
cmdAddToCart.Execute()
}
%>
I have searched high and low for this information. It is a major stumbling block in me understanding how this all works. I would appreciate any help especially the type that really explains how it all comes together. I've bought 6 books in the last two months ranging from Dreamweaver to Java to SQL. The SQL and Java books provide tons of great code. But, they don't tell me where to put it or how to activate it off of an event (like a button click). This has always been a piece of cake for me in the past in other dev environments. You just capture the click, and write the code to do something. I'm just not getting it in Dreamweaver.
Here is the hurdle...
I have a button on a form. When the user clicks the button, I would like to perform an SQL statement. I don't want to submit the form. I just want a few lines of code to execute. Both the button and Function reside in the same page of code.
Here is the button...
<td><input name="AddToCart" type="button" id="AddToCart" onclick="cmdAddToCart()" value="Add to Cart" /></td>
and here is the function I am trying to call on the onclick event.
<%
function cmdAddToCart()
{
var cmdAddToCart = Server.CreateObject("ADODB.Command")
cmdAddToCart.ActiveConnection = MM_connMTPJava_STRING
cmdAddToCart.CommandText = "INSERT INTO Orders (Type ) VALUES ('"+ cmdAddToCart__varType.replace(/'/g, "''") + "' ) "
cmdAddToCart.CommandType = 1
cmdAddToCart.CommandTimeout = 0
cmdAddToCart.Prepared = true
cmdAddToCart.Execute()
}
%>
I have searched high and low for this information. It is a major stumbling block in me understanding how this all works. I would appreciate any help especially the type that really explains how it all comes together. I've bought 6 books in the last two months ranging from Dreamweaver to Java to SQL. The SQL and Java books provide tons of great code. But, they don't tell me where to put it or how to activate it off of an event (like a button click). This has always been a piece of cake for me in the past in other dev environments. You just capture the click, and write the code to do something. I'm just not getting it in Dreamweaver.
