?
Solved

Javascript

Posted on 2015-02-18
4
Medium Priority
?
90 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 33

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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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. …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
Suggested Courses

752 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