View Full Version : string mismatch in Opera!
Crash1hd
08-28-2003, 06:03 AM
I am getting the following String type mismatch in Opera when trying to use the script below
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: ""]'
/Purchases/Purchase_Obits.asp, line 201
the code
FSExpireYear = Request.Form("FSExpireYear")
TotalYear = FSExpireYear-Year(Date)
on the page after submitting?
glenngv
08-28-2003, 06:18 AM
All values retrieve from Request collection are strings.
FSExpireYear = Request.Form("FSExpireYear")
if isNumeric(FSExpireYear) then
TotalYear = CInt(FSExpireYear) - Year(Date)
else
response.write "Please enter a valid year."
response.end
end if
The browser used is immaterial since this is a server-side error.
Crash1hd
08-28-2003, 07:31 AM
I realize beeing that its server side it is not browser related however the above code that I put works in all browsers but the new version of opera?
and even then it works in opera as long as the value for FSExpireYear is greater then 1 if its one I get an error?
also if I write the following
FSExpireYear = Request.Form("FSExpireYear")
if isNumeric(FSExpireYear) then
TotalYear = CInt(FSExpireYear) - Year(Date)
else
response.write "Please enter a valid year."&FSExpireYear&""
response.end
end if
when I use 1 as the value I get Please enter a valid year as the output but if I put more then 1 like 2 i get what should show up being the next page?
scroots
08-28-2003, 10:43 PM
do you have a link so people with opera can test the html output.
scroots
whammy
08-29-2003, 01:40 AM
As glenngv said, that's definitely a server-side error, so perhaps you just don't have "Display friendly HTTP errors" unchecked in IE or something, so you just get "The page cannot be displayed" instead.
If it actually WORKS in another browser, then your computer is either smoking crack, or you're seeing cached pages... but Mr. Vergara's fix should work for you. If not, let us know...
whammy
08-29-2003, 01:45 AM
P.S. You should be doing some more robust validation on the year than just using IsNumeric().
I would use a regular expression that makes sure that:
1. Since it's an expire date, the string starts with "20"
2. It contains 4 digits, and nothing else.
That is rather easy regarding pattern matching...
blahRegexName.Pattern = "^20\d{2}$"
Look at my commonly used functions file if you want to know how to use that pattern in a regex in ASP.
http://www.solidscripts.com/downloads/functions.txt
whammy
08-29-2003, 02:03 AM
P.S. There are a bunch of ways that you can do this that will work as well, using CDate() or DatePart() and comparing the date to another.
Crash1hd
08-30-2003, 03:17 AM
I dont know how but now its all working so I made backups and am leaving it be :confused: :D
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.