ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 19th, 2003, 05:36 AM
matcom matcom is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 9 matcom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy DESPERATE help with IF statement needed

ok. code below. have one page with one text box where user enters a balance(number). then they are forced to click an html image (MUST be this way per boss) which takes them to another page that makes calculations. works fine if they actually enter a number. however, if they fail to enter anything and click the image link, i get a "type mismatch" error. if they do this, i need my var(balance) to equal 0. can anyone help me? so new to all of this. thanks.

balance = request("balance")
if balance <> "" Then
totalnew = balance + 3000 + (balance * .025)
formula1 = .0125 / 12
payment = totalnew * (formula1 / (1 - (1 + formula1) ^ -360))
year1 = FormatCurrency(payment)
year2 = FormatCurrency(year1 * 0.075 + year1)
year3 = FormatCurrency(year2 * 0.075 + year2)
year4 = FormatCurrency(year3 * 0.075 + year3)
year5 = FormatCurrency(year4 * 0.075 + year4)
else
balance = 0
year1 = 0
year2 = 0
year3 = 0
year4 = 0
year5 = 0

end if

Reply With Quote
  #2  
Old November 19th, 2003, 06:12 AM
DarrenMBrink DarrenMBrink is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Ohio
Posts: 30 DarrenMBrink User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 6 sec
Reputation Power: 5
Send a message via AIM to DarrenMBrink
You could always try using cint around balance: cint(balance).

One other thing, I assume your grabing balance from a querystring or from a form on the previous page, with that being said I usually set it up in this fashion but this is personal preference only:

session("variableName") = request("variableName")
variableName = session("variableName")

Again just person preference.

Reply With Quote
  #3  
Old November 19th, 2003, 06:19 AM
matcom matcom is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 9 matcom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks but i am not sure that helps me

let me explain further:

index.html has one text box in a form, one submit button and an "apply now" gif that is a hyperlink to "calculate.asp".

if the user enters say, 100,000 into the text box and presses the submit form button, then the var(balance) has 100,000 as its value. if the user then presses the gif hyperlink, calculate.asp is displayed and all is well.

IF however no value is entered AND submitted on index.html, and the user presses the gif hyperlink, a type mismatch error occurs on the var(balance) and calculate.asp doesn't work. the server returns an error.

essentially i need to idiot-proof this thing so if a user does NOT enter a value, calculate.asp STILL loads with var(balance) equal to 0.

i have tried a simple balance = 0 before the request("balance") but that doesn't work.

thanks again

Reply With Quote
  #4  
Old November 19th, 2003, 07:58 AM
xtremcoder xtremcoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Houston, TX
Posts: 131 xtremcoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 32 m 32 sec
Reputation Power: 6
Send a message via AIM to xtremcoder Send a message via Yahoo to xtremcoder
i havent read all the thread, but i see a potential problem right away. try request.form("balance")

Reply With Quote
  #5  
Old November 19th, 2003, 08:27 AM
DarrenMBrink DarrenMBrink is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Ohio
Posts: 30 DarrenMBrink User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 6 sec
Reputation Power: 5
Send a message via AIM to DarrenMBrink
if xtremcoder's advice doesn't solve your problem could you attach your html page and that asp page so I could see all of your code.

Reply With Quote
  #6  
Old November 19th, 2003, 08:29 AM
matcom matcom is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 9 matcom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thank. xtremcoder did it for me

appreciate ALL your help everyone!

you are all great

Reply With Quote
  #7  
Old November 19th, 2003, 01:06 PM
xtremcoder xtremcoder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Houston, TX
Posts: 131 xtremcoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 32 m 32 sec
Reputation Power: 6
Send a message via AIM to xtremcoder Send a message via Yahoo to xtremcoder
any time...

Reply With Quote
  #8  
Old November 19th, 2003, 01:22 PM
valwoods valwoods is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 valwoods User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
you might be able to do this by:
dim balance
if request.form("balance")="" then
balance="0"
else
balance=request.form("balance")
end if

Reply With Quote
  #9  
Old November 20th, 2003, 12:45 AM
unclefu unclefu is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 120 unclefu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 57 sec
Reputation Power: 5
if isNumeric(Request.Form("Balance")) then
balance = cint(request.form("Balance"))
else
balance = 0
end if

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > DESPERATE help with IF statement needed


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway