Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 99
  • Last Modified:

Javascript

I have a form like this:

<form method="post" name="st" action="cust_updt.php" onSubmit="return chk_vals();">

Something wasn't working in the subsequent page so I put a few alerts into the chk_vals function; see attached.

The alerts do NOT display

From my past experience, there is probably something wrong with this or other javascript on the page. I turned on FireFox WebConsole & ran it again; nothing.

How can I debug the Javascript; there is more above the chk_vals function, I suspect the error is there?

Thanks
chk-vals.js
0
Richard Korts
Asked:
Richard Korts
  • 2
1 Solution
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
do you have Chrome installed? I find their Developers Console really easy to use, especially with javascript errors.

can you provide a link to the page?
0
 
OriNetworksCommented:
You have invalid syntax particularly on the line
alert "Invalid character ^ in last name."

Open in new window

should be
alert("Invalid character ^ in last name.");

Open in new window

0
 
OriNetworksCommented:
Also I'm not sure what you're trying to do with <?  ?> but that is invalid syntax as well unless you have some other component overwriting those values.  

document.st.action = "cust_wonsn.php?cid=" + cid + "&pstr="<? print $pstr; ?> + "&type="<? print $type; ?>;

temporarily change it to

document.st.action = "cust_wonsn.php?cid=" + cid + "&pstr=&type=";

Open in new window


JavaScript syntax validator:
http://esprima.org/demo/validate.html
0
 
Richard KortsAuthor Commented:
Of course I looked right at those & didn't see it.

On the <?   ?>, that is php, I'd forgotten that was in there; that gets resolved on the server.

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now