Problem calling function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marc

    #1

    Problem calling function

    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_ques tions"
    method="post"
    onSubmit="retur n checkForm(this) ;">

    [...]

    function checkForm(theFo rm){
    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
  • kaeli

    #2
    Re: Problem calling function

    In article <acad69df.03101 50721.6e423d0f@ posting.google. com>,
    meelzooi2000@ya hoo.com enlightened us with...[color=blue]
    > 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,
    >[/color]

    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.


    -------------------------------------------------

    Comment

    • Lasse Reichstein Nielsen

      #3
      Re: Problem calling function

      meelzooi2000@ya hoo.com (Marc) writes:
      [color=blue]
      > 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?[/color]

      Most likely. That would mean that the function isn't declared because
      it failed during parsing.
      [color=blue]
      > Does a debugger exist for javascript code (win2k)???[/color]

      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.netsc ape.com/software/jsdebug-4x.html>
      Microsoft Script Debugger:
      <URL:http://microsoft.com/downloads/details.aspx?Fa milyId=2F465BE0-94FD-4569-B3C4-DFFDF19CCD99&di splaylang=en>

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

      Comment

      Working...