Solved

Javascript

Posted on 2015-02-18
4
85 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

691 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