| |
llhockley
Posts: 2
Score: 0
Joined: 8/4/2004
From:
Status: offline
|
Good afternoon, I'm new to HTML/ASP/VBScript etc. I have a middle tier that contains my business objects (DCOM), and in this case I have a purchase object that is responsible for taking data from my ASP/VBScript page and post back to update my database. Now, my problem is that once i click my 'purchase' button the function or script routine that is driven by the OnClick event, will not instantiate my purchase object AND does not recognise the object variable if I instantiated it in the form header or page header. This is an example of the current code: <%@ LANGUAGE="VBScript" CODEPAGE="932" %> <% Dim oPurchase, oProduct SET oProduct = Server.CreateObject( "Product.cusProduct" ) %> <HTML> <HEAD> </HEAD> <BODY> <FORM NAME="Form"> <P> <HR> <HR> Product: <SELECT id=lstProducts style="WIDTH: 287px" name=lstProducts> <% Response.Write(oProduct.cHTMLString) %> </OPTION> </SELECT> Quantity: <INPUT id=txtQuantity style="WIDTH: 109px; HEIGHT: 25px" size=10 value=0 name=txtQuantity> </P> <P><INPUT id=cmdPurchase type=button value=Purchase name=cmdPurchase> <SCRIPT FOR="cmdPurchase" EVENT="onClick" LANGUAGE="VBScript"> SET oPurchase = Server.CreateObject( "Purchase.cusPurchase" )<--failure is here, but if this line is added to top section it instantiates ok, but then method below OR ISOBJECT fails. IF NOT ISOBJECT(oPurchase) THEN MSGBOX "Purchasing object not available." ELSE IF (oPurchase.Purchase(document.form.lstProducts.document.form.txtQuantity.value)=1) THEN MSGBOX "Purchase complete." ELSE MSGBOX "Purchase failed." END IF END IF </SCRIPT> </P> </P> </FORM> </BODY> </HTML>
|
|