Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

empty data fields

Status
Not open for further replies.

920506

Programmer
Jun 13, 2003
201
US
Hi everyone,
Recently, I am investigating a bug of javascript problem in our asp page. Somehow it always crashed in the same places in one of our asp pages for 10 times. The data fields are empty, with those fields, I collected data using JavaScript(not backed up by asp program)
But I cannot duplicate the case in my windows XP and 2000. Then suddenly I found 8 of 10 have this log text:
---UserAgent Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)
*MSIE version could be different in this line, most of them is 5.22 and some are 5.0 and 5.23

I don't know the exact meaning of the line, it seems like IE installed on MAC operating system, it seems like our program doesn't work the same way as it is on windows system with IE or firefox installed etc. We only tested on windows with IE, firefox and AOL.
Am I close to the origination of the problem source?
Thank you.
Betty
 
sorry I didn't understand the problem well. Are you refereing to client side javascripting or server side? What is the bug? What event causes it and what is the result of the broken process

Is this a Mac with IE?


____________ signature below ______________
General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
Hi onpnt,
I mean client side javascript,server side is VBscript.

The error message is:
CInt(afieldnum)-->type mismatch,
because the afieldnum is empty.
I used javascript to collect data for this field.
When code try to display the field:

Response.Write CInt(afieldnum)
The program crashed.
Betty
 
You'll need to catch the fact it's empty prior to running any built in conversion functions in any programming language. vbscript is poor at really doing this and in all the built in functionality. Basically you have to check for Null, blank an empty to cover your points.

Creating a function to handle this is of course the cleanest way to take care of it.

Something like
Code:
function validateValue(val)
  If IsNull(val) OR val = "" OR IsEmpty(val) Then
     validateValue = 0
  Else
     validateValue = val
  End If
end function

Response.Write  validateValue(CInt(afieldnum))


____________ signature below ______________
General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top