|
| |
|
|
kenk
Posts: 76 Joined: 1/16/2006 Status: offline
|
Mathamatical calculation on a form - 3/5/2009 15:57:49
I am trying to do a simple mathamatical calculation and pass the result to another form.....preferably on the same page. Right now I can add text to a field on the form and it is passed to the results box in the second form, I cannot get the math to work. I found a way that is supposed to work but cannot get it to do so. I was told name the fields a,b,c...etc. field c= a+b; e=c*d.....to look like: <% dim a,b,c,d,e a=Request("FormField1") b=Request(:FormField2") c=a+b d=Request("FormField4") e=c*d %> In the second form make the default value: <%=e%> Where do I put this code? That may be my problem...not putting it in the correct place???? Thanx for any suggestions......KenK
|
|
|
|
jeepless
Posts: 230 Joined: 12/20/2003 From: Smack in the middle of USA Status: offline
|
RE: Mathamatical calculation on a form - 3/5/2009 19:20:15
Try this: <% dim a,b,c,d,e a=Request.form("Field1") b=Request.form("Field2") c=a+b d=Request.form("Field4") e=c*d %>
_____________________________
The problem with designing a system that's foolproof is that designers underestimate complete fools.
|
|
|
|
kenk
Posts: 76 Joined: 1/16/2006 Status: offline
|
RE: Mathamatical calculation on a form - 3/5/2009 22:26:14
I'll try that soon and let you know....thanx, Kenk
|
|
|
|
kenk
Posts: 76 Joined: 1/16/2006 Status: offline
|
RE: Mathamatical calculation on a form - 3/5/2009 22:48:02
It is not doing the math....it just passes thru the numbers that have been entered into each field....it did not even do that before. I entered 1, 2, 3 in fields 1,2,3 and when I submitted, the result in the proper "new" field is 123.
|
|
|
|
BeTheBall
Posts: 6493 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Mathamatical calculation on a form - 3/5/2009 23:35:57
<% dim a,b,c,d,e a=CLng(Request.form("Field1")) b=CLng(Request.form("Field2")) c=a+b d=CLng(Request.form("Field4")) e=c*d %>
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
kenk
Posts: 76 Joined: 1/16/2006 Status: offline
|
RE: Mathamatical calculation on a form - 3/6/2009 10:04:39
Hey Be The Ball....thanx for the response......I'll give it a try. This has been frustrating. Cannot try until I get to the right computer this evening and then I'll let you know.....Kenk
|
|
|
|
kenk
Posts: 76 Joined: 1/16/2006 Status: offline
|
RE: Mathamatical calculation on a form - 3/6/2009 23:54:16
Thanx for the response....the math works....but now I am getting a Microsoft VBScript runtime error 800a000d Type mismatch: CLng on the first form page where I input the numbers. I enter numbers in each field and click submit and the next form page shows the proper calculated result but in fornt of the field is the message: mode set. I searched the 800 a000d error message and it says there is a script message. I checked and my input agrees with what you sent??????
|
|
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
|
|
|