Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VBScript driving me MAD!

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2108
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript driving me MAD!
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VBScript driving me MAD! - 2/18/2005 6:27:27 AM   
  olimess

 

Posts: 12
Score: 0
Joined: 2/17/2005
From:
Status: offline
I'm fairly new to this so forgive me for my ignorance.

I'm working on this page below. I basically have an orderTotal variable defined in the script that I set to certain values. If orderTotal is over under 100 then four shippng options are available, if its 100 or over then three shipping options are available.

My problem is that when I choose an option and press calculate I run into an error. As you might be able to tell from the code I've been trying everything. I'm sure there's a way smarter way of doing this error free. Here's the page. Right click for the code as usual. Thanks ALL!

http://69.93.132.52/polylabel.com/test.asp
 
 
Post #: 1
 
 Re: VBScript driving me MAD! - 2/18/2005 8:09:25 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
It returns nothing to me, not even an error.

(in reply to olimess)
 
 
Post #: 2
 
 Re: VBScript driving me MAD! - 2/18/2005 8:14:27 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
Line:12
Char:1
Call is undefined

(in reply to olimess)
 
 
Post #: 3
 
 Re: VBScript driving me MAD! - 2/18/2005 9:55:38 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
woohoo! How did you do that tnoonan ?

(in reply to olimess)
 
 
Post #: 4
 
 Re: VBScript driving me MAD! - 2/18/2005 3:07:41 PM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
run it again. Got the info from lower left hand side reserved for jscript errors. click and click details That's what it reports. Not sure he said it was or was not vbscript or jscript. View source does not reviel.

(in reply to olimess)
 
 
Post #: 5
 
 Re: VBScript driving me MAD! - 2/18/2005 7:55:51 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
hm... Now I got it; was using firefox and it didn't give me errors of any sort.

Thanks.

(in reply to olimess)
 
 
Post #: 6
 
 Re: VBScript driving me MAD! - 2/21/2005 2:51:12 AM   
  olimess

 

Posts: 12
Score: 0
Joined: 2/17/2005
From:
Status: offline
Hmmm .. guess that didn't help out my situation much. Can anyone point me to the right resource online since no one seems to be able to help me out?

Thanks All.

(in reply to olimess)
 
 
Post #: 7
 
 Re: VBScript driving me MAD! - 2/21/2005 3:01:45 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Olimess,

Without seeing any code it is very difficult for people to help. Viewsource only shows HTML and not the scripting. About all that can be seen is the fact that you are receiving the following error:

quote:

Line: 12
Char: 1
Error: 'call' is undefined
Code: 0
URL: http://69.93.132.52/polylabel.com/test.asp



Also, Did you ever look at your first post ? I posted a fix to a problem there and it seems that you are using the same look for the ASP page above. Could that be worked into what you are working on here?
http://www.visualbasicscript.com/topic.asp?TOPIC_ID=2093

(in reply to olimess)
 
 
Post #: 8
 
 Re: VBScript driving me MAD! - 2/21/2005 4:14:35 AM   
  olimess

 

Posts: 12
Score: 0
Joined: 2/17/2005
From:
Status: offline
Thanks Mike.

Here is the code. I basically need this to be dynamic so that everything is calculated and shown.

<HTML>
<HEAD>

</HEAD>
<BODY>
<FORM NAME="form">
<%
Dim orderTotal
orderTotal = 95
Dim Tax
Dim Subtotal
Dim TAX_RATE
Dim TotalCost

TAX_RATE = 0.06

sub cmdCalculate
Select Case TRUE
Case document.all.s1.Checked
ShipCost = 5
msgbox "This is 5"
Case document.all.s2.Checked
ShipCost = 10
Case document.all.s3.Checked
ShipCost = 16
Case document.all.s4.Checked
ShipCost = 20
End Select


' Perform order calculations.
Subtotal = ShipCost + orderTotal
AmountofTax = Subtotal * TAX_RATE
TotalCost = Subtotal + AmountofTax

' Display the results.
Document.form.lblSubtotal.Caption = FormatCurrency(Subtotal)
Document.form.lblTaxes.Caption = FormatCurrency(AmountofTax)
Document.form.lblTotalCost.Caption = FormatCurrency(TotalCost)
End sub
Response.Write("<TABLE><TR><TD><B>Shipping Options:</B></TD></tr>" + vbCrLf)
if orderTotal > 0 and orderTotal < 100 then

Response.Write("<tr>" + vbCrLf)
Response.Write("<td colspan=3> </td>" + vbCrLf)
Response.Write("<td><table style=""font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #094577; font-weight: bold;""><tr>" + vbCrLf)
Response.Write("<td><br><input type=radio name=shippingcost id=s1> Airmail: </td>")
Response.Write("<td align=""right""><br> $5.00</td></tr>")
Response.Write("<tr><td><input type=radio name=shippingcost id=s2> Standard: </td>")
Response.Write("<td align=""right""> $10.00</td></tr>")
Response.Write("<tr><td><input type=radio name=shippingcost id=s3> 3-Day: </td>")
Response.Write("<td align=""right""> $16.00</td></tr>")
Response.Write("<tr><td><input type=radio name=shippingcost id=s4> Overnight: </td>")
Response.Write("<td align=""right""> $20.00</td></tr></table></td></tr>" + vbCrLf)
else
Response.Write("<tr>" + vbCrLf)
Response.Write("<td colspan=3> </td>" + vbCrLf)
Response.Write("<td><table style=""font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #094577; font-weight: bold;""><tr>" + vbCrLf)
Response.Write("<tr><td><input type=radio name=shippingcost id=s2> Standard: </td>")
Response.Write("<td align=""right""> $10.00</td></tr>")
Response.Write("<tr><td><input type=radio name=shippingcost id=s3> 3-Day: </td>")
Response.Write("<td align=""right""> $16.00</td></tr>")
Response.Write("<tr><td><input type=radio name=shippingcost id=s4> Overnight: </td>")
Response.Write("<td align=""right""> $20.00</td></tr></table></td></tr>" + vbCrLf)
end if
Response.Write("</TR><TD colspan=2><INPUT TYPE='Button' NAME=Calculate VALUE='Calculate Totals' onclick=call cmdCalculate()></TD>" + vbCrLf)
Response.Write("</TR><TR><TD><B>Subtotal:</B></TD><TD>" + vbCrLf)



Response.Write("<OBJECT ID=lblSubtotal WIDTH=100 HEIGHT=24" + vbCrLf)
Response.Write("CLASSID=""CLSID:978C9E23-D4B0-11CE-BF2D-00AA003F40D0"">" + vbCrLf)
Response.Write("<PARAM NAME=""ForeColor"" VALUE=""0"">" + vbCrLf)
Response.Write("<PARAM NAME=""BackColor"" VALUE=""16777215"">" + vbCrLf)
Response.Write("<PARAM NAME=""Caption"" VALUE="""">" + vbCrLf)
Response.Write("<PARAM NAME=""Size"" VALUE=""1582;635"">" + vbCrLf)
Response.Write("<PARAM NAME=""SpecialEffect"" VALUE=""2"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontHeight"" VALUE=""200"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontCharSet"" VALUE=""0"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontPitchAndFamily"" VALUE=""2"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontWeight"" VALUE=""0"">" + vbCrLf)
Response.Write("</OBJECT></TD></TR><TR><TD><B>Taxes:</B></TD><TD>" + vbCrLf)

Response.Write("<OBJECT ID=lblTaxes WIDTH=100 HEIGHT=24" + vbCrLf)
Response.Write("CLASSID=""CLSID:978C9E23-D4B0-11CE-BF2D-00AA003F40D0"">" + vbCrLf)
Response.Write("<PARAM NAME=""ForeColor"" VALUE=""0"">" + vbCrLf)
Response.Write("<PARAM NAME=""BackColor"" VALUE=""16777215"">" + vbCrLf)
Response.Write("<PARAM NAME=""Caption"" VALUE="""">" + vbCrLf)
Response.Write("<PARAM NAME=""Size"" VALUE=""1582;635"">" + vbCrLf)
Response.Write("<PARAM NAME=""SpecialEffect"" VALUE=""2"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontHeight"" VALUE=""200"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontCharSet"" VALUE=""0"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontPitchAndFamily"" VALUE=""2"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontWeight"" VALUE=""0"">" + vbCrLf)
Response.Write("</OBJECT></TD></TR><TR><TD><B>Total Cost:</B></TD><TD>" + vbCrLf)

Response.Write("<OBJECT ID=lblTotalCost WIDTH=100 HEIGHT=24" + vbCrLf)
Response.Write("CLASSID=""CLSID:978C9E23-D4B0-11CE-BF2D-00AA003F40D0"">" + vbCrLf)
Response.Write("<PARAM NAME=""ForeColor"" VALUE=""0"">" + vbCrLf)
Response.Write("<PARAM NAME=""BackColor"" VALUE=""16777215"">" + vbCrLf)
Response.Write("<PARAM NAME=""Caption"" VALUE="""">" + vbCrLf)
Response.Write("<PARAM NAME=""Size"" VALUE=""1582;635"">" + vbCrLf)
Response.Write("<PARAM NAME=""SpecialEffect"" VALUE=""2"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontHeight"" VALUE=""200"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontCharSet"" VALUE=""0"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontPitchAndFamily"" VALUE=""2"">" + vbCrLf)
Response.Write("<PARAM NAME=""FontWeight"" VALUE=""0"">" + vbCrLf)
Response.Write("</OBJECT></TD></TR></TABLE>" + vbCrLf)
%>
</FORM>
</body>
</html>

(in reply to olimess)
 
 
Post #: 9
 
 Re: VBScript driving me MAD! - 2/21/2005 6:00:01 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Not sure why you are using response.write to write everything, but I think that is your problem. When I take what you posted and create an ASP page I get the same error as before, Line: 12, Error: 'call' is undefined. Now, when I look at the ASP doc line 12 is
quote:
Dim TAX_RATE
which would not give that error. I then looked at the source code for the asp page and line 12 is:
quote:
</TR><TD colspan=2><INPUT TYPE='Button' NAME=Calculate VALUE='Calculate Totals' onclick=call cmdCalculate()></TD>


I then looked at the source code a little closer and found that the call you are making (cmdCalculate)is not in any other place in the code. There is no scripting in the source code. I then took the code that I posted in the other post and pasted it into the ASP page. This worked. Try that.

(in reply to olimess)
 
 
Post #: 10
 
 Re: VBScript driving me MAD! - 2/21/2005 6:06:25 AM   
  Bushmen

 

Posts: 122
Score: 0
Joined: 2/4/2005
From:
Status: offline
hi,

could anyone explain to me what Respone.Write do?

is it the same as wscript.echo, but since its asp??

bushmen

(in reply to olimess)
 
 
Post #: 11
 
 Re: VBScript driving me MAD! - 2/21/2005 6:10:43 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
I think that is the case. It will write what you want to the browser window.

(in reply to olimess)
 
 
Post #: 12
 
 Re: VBScript driving me MAD! - 2/21/2005 6:13:55 AM   
  Bushmen

 

Posts: 122
Score: 0
Joined: 2/4/2005
From:
Status: offline
cheers mike

(in reply to olimess)
 
 
Post #: 13
 
 Re: VBScript driving me MAD! - 2/21/2005 6:38:47 AM   
  olimess

 

Posts: 12
Score: 0
Joined: 2/17/2005
From:
Status: offline
Ooopsss. I responded to the wrong post .... anyways here is what I intended to say in this post.

Maybe someone else can say this better than me but, response.write is how to write HTML code from VBscript. This allows you to code dynamic page and such.

MIKE.

Thanks for your help so far. I've tried cleaning up the code and doing as you said but to no evail. Any other suggestions??

Here's the new code: http://69.93.132.52/polylabel.com/test2.asp


<HTML>
<HEAD>
<SCRIPT LANGUAGE="VBScript">
<!--
Dim orderTotal
orderTotal = 95
Dim Tax
Dim Subtotal
Dim TAX_RATE
Dim TotalCost

TAX_RATE = 0.06

Sub cmdCalculate
Select Case TRUE
Case document.all.s1.Checked
ShipCost = 5
msgbox "This is 5"
Case document.all.s2.Checked
ShipCost = 10
Case document.all.s3.Checked
ShipCost = 16
Case document.all.s4.Checked
ShipCost = 20
End Select


' Perform order calculations.
Subtotal = ShipCost + orderTotal
AmountofTax = Subtotal * TAX_RATE
TotalCost = Subtotal + AmountofTax

' Display the results.
Document.form.lblSubtotal.Caption = FormatCurrency(Subtotal)
Document.form.lblTaxes.Caption = FormatCurrency(AmountofTax)
Document.form.lblTotalCost.Caption = FormatCurrency(TotalCost)
End sub

-->
</SCRIPT>

</HEAD>
<BODY>
<FORM NAME="form">
<TABLE><TR><TD><B>Shipping Options:</B></TD></tr>
<%
if orderTotal > 0 and orderTotal < 100 then
%>
<tr>
<td><table style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #094577; font-weight: bold;"><tr>
<td><br><input type=radio name="shippingcost" id="s1"> Airmail: </td>
<td align="right"><br> $5.00</td></tr>
<tr><td><input type=radio name="shippingcost" id="s2"> Standard: </td>
<td align="right"> $10.00</td></tr>
<tr><td><input type=radio name="shippingcost" id="s3"> 3-Day: </td>
<td align="right"> $16.00</td></tr>
<tr><td><input type=radio name=shippingcost id="s4"> Overnight: </td>
<td align="right"> $20.00</td></tr></table></td></tr>
<%
else
%>
<tr>
<td colspan=3> </td>
<td><table style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #094577; font-weight: bold;"><tr>
<tr><td><input type=radio name="shippingcost" id="s2"> Standard: </td>
<td align="right"> $10.00</td></tr>
<tr><td><input type=radio name="shippingcost" id="s3"> 3-Day: </td>
<td align="right"> $16.00</td></tr>
<tr><td><input type=radio name=shippingcost id="s4"> Overnight: </td>
<td align="right"> $20.00</td></tr></table></td></tr>
<%
end if
%>
<tr><TD colspan=2><INPUT TYPE="Button" NAME=Calculate VALUE="Calculate Totals" onclick=cmdCalculate()></TD>
</TR><TR>
<TD><B>Subtotal:</B></TD>
<TD>
<OBJECT ID="lblSubtotal" WIDTH=45 HEIGHT=24
CLASSID="CLSID:978C9E23-D4B0-11CE-BF2D-00AA003F40D0">
<PARAM NAME="ForeColor" VALUE="0">
<PARAM NAME="BackColor" VALUE="16777215">
<PARAM NAME="Caption" VALUE="">
<PARAM NAME="Size" VALUE="1582;635">
<PARAM NAME="SpecialEffect" VALUE="2">
<PARAM NAME="FontHeight" VALUE="200">
<PARAM NAME="FontCharSet" VALUE="0">
<PARAM NAME="FontPitchAndFamily" VALUE="2">
<PARAM NAME="FontWeight" VALUE="0">
</OBJECT>
</TD>
</TR>
<TR>
<TD><B>Taxes:</B></TD>
<TD>
<OBJECT ID="lblTaxes" WIDTH=45 HEIGHT=24
CLASSID="CLSID:978C9E23-D4B0-11CE-BF2D-00AA003F40D0">
<PARAM NAME="ForeColor" VALUE="0">
<PARAM NAME="BackColor" VALUE="16777215">
<PARAM NAME="Caption" VALUE="">
<PARAM NAME="Size" VALUE="1582;635">
<PARAM NAME="SpecialEffect" VALUE="2">
<PARAM NAME="FontHeight" VALUE="200">
<PARAM NAME="FontCharSet" VALUE="0">
<PARAM NAME="FontPitchAndFamily" VALUE="2">
<PARAM NAME="FontWeight" VALUE="0">
</OBJECT>
</TD>
</TR>
<TR>
<TD><B>Total Cost:</B></TD>
<TD>
<OBJECT ID="lblTotalCost" WIDTH=45 HEIGHT=24
CLASSID="CLSID:978C9E23-D4B0-11CE-BF2D-00AA003F40D0">
<PARAM NAME="ForeColor" VALUE="0">
<PARAM NAME="BackColor" VALUE="16777215">
<PARAM NAME="Caption" VALUE="">
<PARAM NAME="Size" VALUE="1582;635">
<PARAM NAME="SpecialEffect" VALUE="2">
<PARAM NAME="FontHeight" VALUE="200">
<PARAM NAME="FontCharSet" VALUE="0">
<PARAM NAME="FontPitchAndFamily" VALUE="2">
<PARAM NAME="FontWeight" VALUE="0">
</OBJECT>
</TD>
</TR>
</TABLE>
</FORM>
</body>
</html>



Thanks all!

(in reply to olimess)
 
 
Post #: 14
 
 Re: VBScript driving me MAD! - 2/21/2005 6:46:43 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
I have never claimed to be good at writing html/asp but was offering help. As to what you posted, I am getting an error on line 15, Object doesn't support this property in reference to document.all.s1. When I look at the source code I do not see that line
<td><br><input type=radio name="shippingcost" id="s1"> Airmail: </td>
For some reason this is not being displayed.

(in reply to olimess)
 
 
Post #: 15
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBScript driving me MAD! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts