By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,474 Members | 1,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,474 IT Pros & Developers. It's quick & easy.

Problem calling function

P: n/a
Hello,
I have a form. On submit I want a javaScript to check if any fields
are filled in and if so, if the fields that correspond to the filled -
in fields are also filled in.

I wrote a js function which gets called onSubmit.

But I don't have the change to see if the js I wrote works because the
script doesn't even get called - I put an alert('test'); in the first
line of the function definition but after a submit there's no alert:

<form name="form_questions"
method="post"
onSubmit="return checkForm(this);">

[...]

function checkForm(theForm){
alert("inside the function!");
[....]
}

If I put an alert('test'); directly after the onSubmit:
onSubmit="alert('test');">

Here I DO get an alert after form submission.

I have no clue as to what is wrong here since nothing happens. Very
frustrating, I can't continue developing this way.
Could it be a syntax error? Does a debugger exist for javascript code
(win2k)???

Thanks for any tips & help,

Marc
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In article <ac**************************@posting.google.com >,
me**********@yahoo.com enlightened us with...
I have no clue as to what is wrong here since nothing happens. Very
frustrating, I can't continue developing this way.
Could it be a syntax error? Does a debugger exist for javascript code
(win2k)???

Thanks for any tips & help,


I have had this happen when there is an error in the function. Remove
everything from the function except that alert. If it works then, the
problem is with the code in the function.

Netscape debugs better than IE. Try it in NN7 and type "javascript:" in
the location bar.

-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #2

P: n/a
me**********@yahoo.com (Marc) writes:
I have no clue as to what is wrong here since nothing happens. Very
frustrating, I can't continue developing this way.
Could it be a syntax error?
Most likely. That would mean that the function isn't declared because
it failed during parsing.
Does a debugger exist for javascript code (win2k)???


Several. Although, all you probably need is useful error messages.
In Opera and Mozilla you can see usable error messages by opening the
Javascript console.
In IE, you can turn on (not very useful) error messages.

If you really want a debugger, here are some:

Venkman for Mozilla:
<URL:http://www.mozilla.org/projects/venkman/>
Netscape Javascript Debugger for Netscape 4:
<URL:http://developer.netscape.com/software/jsdebug-4x.html>
Microsoft Script Debugger:
<URL:http://microsoft.com/downloads/details.aspx?FamilyId=2F465BE0-94FD-4569-B3C4-DFFDF19CCD99&displaylang=en>

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.