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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Expected

Status
Not open for further replies.

jliz2803

IS-IT--Management
Mar 21, 2005
45
CA
HI I am trying to write a function that validates a field only if focus gets set to that field. I am currently using OnBlur, and it tries to validate but then I get an error message that states an object is expected. Here is the code for the function. Any ideas?

Response.Write ("function GMAC_CancellationNameOnBlur ()" & vbCRLF)
Response.Write ("{" & vbCRLF)
Response.Write (" if (IsBlank (Form.GMAC_CancellationName.value))" & vbCRLF)
Response.Write (" {" & vbCRLF)
Response.Write (" if (FirstField === (void 0))" & vbCRLF)
Response.Write (" {" & vbCRLF)
Response.Write (" FirstField = Form.GMAC_CancellationName;" & vbCRLF)
Response.Write (" }" & vbCRLF)
Response.Write (" msg += ' - Please enter name of Cancelling Party\n';" & vbCRLF)
Response.Write (" }" & vbCRLF)
Response.Write ("}" & vbCRLF)
Response.Write (vbCRLF)
 
Do you have a function called IsBlank() somewhere? If not, I imagine that is the line that is causing the error. Javascript doesn't have a native IsBlank function.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Yes i do have an IsBlank Function, and it works properly. Ihad a problem of the form field being validated at a time I didn't want it to, so I am trying to make it so that it is only validated when focus gets into it.
 
I tried the onchange and the onclick and still got the object expected error. Is there anyway to set a variable in VBScript code and use it in the javascript code within the same document?
 
Not that I am aware of. You could set the contents of a hidden text field in VB and read it using Javascript... but that limits you to the data type. Might do the trick though!

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
I got it I was just writing the function in the wrong part of my javascript. Thanks for your help you have helped me twice today you are truly a saint.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top