View Full Version : Javascript stops working when used inside a <form>

04-24-2008, 11:30 AM

Part of my web app at work has recently stopped working, it worked for a good couple of years and has at some point stopped working. Basically it just displays some fancy tooltip text when you mouse over an <input>

Now after much debugging yesterday I have managed to get it working but only if i remove the <form> tag that handles the form.

i.e. remove the <form blah blah blah> line and the tooltips work but obviously the form wont work anymore, put it back in the form works fine but the tooltips dont.

Is there some new security feature or something that im missing here or has anyone got any ideas what this may be, because im starting to run out of ideas.

If need be I can submit the code but theres loads of it and an external javascript file that the tooltip thingie uses.



04-24-2008, 11:45 AM
we need to see the code

04-24-2008, 12:06 PM
Ok heres the code, Had to add it as a zip as it was too big to post as text on here, have been running this from a c:\test folder on my hard drive.

This code may look abit weird but its generated on the fly from a foxpro com object, bit of a odd ball setup but it does work.

Like i said if you keep the <form> tag in the tooltips dont work, take it out and they work fine.

Ive been at this now for a day and a half solid and im getting nowhere :mad:

Thanks again


04-24-2008, 12:22 PM
this is what I mean, this is with the first <form> tag in place

http://img236.imageshack.us/img236/3772/notworkingwg5.gif (http://imageshack.us)

remove the first <form> tag and it works correctly

http://img292.imageshack.us/img292/2221/workingxy5.gif (http://imageshack.us)

thanks yet again :)

Arty Effem
04-24-2008, 02:33 PM
remove the first <form> tag and it works correctly
The error message indicates that a property called 'title' is expected to be of type 'string' but isn't.

On line 522 of your markup you have named an element 'title', which is causing the problem.

You can tighten the script by changing line 67 from
if (curNode.title)
if (curNode.title && typeof curNode.title=='string')

04-24-2008, 02:46 PM
Mate your a life saver, i owe you one big time :thumbsup:

thanks very much.