Solved

Javascript

Posted on 2015-02-18
4
75 Views
Last Modified: 2015-02-18
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
Comment
Question by:Richard Korts
  • 2
4 Comments
 
LVL 32

Expert Comment

by:Big Monty
ID: 40617375
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
 
LVL 17

Accepted Solution

by:
OriNetworks earned 500 total points
ID: 40617773
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
 
LVL 17

Expert Comment

by:OriNetworks
ID: 40617780
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
 

Author Closing Comment

by:Richard Korts
ID: 40617787
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now