vbscript error (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


Rizzo -> vbscript error (12/13/2001 13:28:40)

Hi, I'm trying to debug my vbscript but having some trouble. I have a form that posts info into another form. The problem is when I leave certain fields blank I get this error.

Microsoft VBScript runtime error '800a000d'
Type mismatch:

Is there any way to tell my page that if there is no value entered into a field then don't give me an error?

'this requests the info from my form
PAY_R = request.form("RATE")
'this is the inital value in my second form
<%= formatnumber((PAY_R)*1) %>







Mojo -> RE: vbscript error (12/13/2001 15:52:52)

It looks like your trying to multiply without any values if the field is left blank. I would try something like this on the second form:

<%
PAY_R = request.form("RATE")
If Len(PAY_R) < 1 Then PAY_R = 0
%>

Now you will have 1*0 which should at least give you a value.

You could do other things such as:
<%
PAY_R = request.form("RATE")
If Len(PAY_R) < 1 Then
PAY_R = "No value entered"
Else
PAY_R = PAY_R * 1
End If
%>
Now, in your initial value of the form field use:
<%=PAY_R %>

Now, if they leave the field blank on the first form they will see the message. If not, the value will be shown.

Joe

grrr... I had to edit the last response.write


Edited by - jbennett on 12/13/2001 15:58:37




Rizzo -> RE: vbscript error (12/13/2001 16:21:13)

Thanks Dude!





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875