Validators Raising ClientScript Errors (VS2003)

A

Axel Dahmen

Hi,

I've added a couple of validators to my page. Now I get a couple of Runtime
Errors when I load the page (I have "Show client-script errors" enabled in
IE6):

"A Runtime Error has occurred. Do you wish to debug? Line: ... Error:
Expected ';'"

This shouldn't happen. Adding the validators to the pages has changed
"something" but I don't understand what. Now I have a couple of questions
and hopefully someone can enlighten me on this:

* In my code-behind I've added an onclick event handler to one of the
buttons, like "return DoSomething()", having DoSomething() returning false
so that the button doesn't cause a postback. ASP.NET puts validation code
BEHIND my code - so the validation code never gets executed. How can I
change this?

* Actually for this button I don't need to go through validation as it just
opens a pop-up window. So I set CausesValidation="False" which keeps ASP.NET
from adding validation code to the button. Still the JavaScript Runtime
Error occurs when the page reaches the onclick event on load - why?

* The IE error message offers me to debug by providing me with two buttons:
Yes/No. If I click "Yes", nothing happens, i.e. execution is not brought
into Visual Studio - why?

I'm baffled. I'd really appreciate if someone could give me some answers on
these issues.

TIA,
Axel Dahmen
 
S

S. Justin Gengo

Axel,

Without seeing the source code I can't say for certain, but hopefully this
will lead you to the problem:

Javascript, like c# ends each line command with a semicolon. The error you
are seeing is saying that one of the javascripts on your page does not have
a semicolon at the end of it. Check the scripts you are calling and where
you are calling them from and make certain that appropriate commands end
with a semicolon.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
B

Bruce Barker

when you added a client event handelr, you shoudl also specify a ";", incase
stanard page handling also adds code, ex: "return DoSomething();" if you
conditionaly want to run page handling client code, then use an if.
ex "if (DoSomething()) return;"

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top