Expected ';' - Javascript error in asp.net page

L

Luigi

Hi all,
in my ASP.NET 3.5 application I'm having this javascript error when I open
some pages:


User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0;
SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media
Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)
Timestamp: Mon, 15 Mar 2010 11:12:39 UTC


Message: Expected ';'
Line: 206
Characted: 45
Code: 0
URI: mypath

and if I click F12 in IE8 to view the source of the page, the line 206
begins with:

var

WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID
= document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID");

in the code:



<script type="text/javascript">
//<![CDATA[
va
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.controltovalidate =
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.display =
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.evaluationfunction =
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.validationexpression =
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID
= document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID");"WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateTextBoxID";"Dynamic";"RegularExpressionValidatorEvaluateIsValid";"^\\s*(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))\\s*$";

va
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID.controltovalidate =
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID.errormessage =
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID.display =
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID.evaluationfunction =
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID.initialvalue =
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID
= document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID");"WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateTextBoxID";"Campo
[Data] obbligatorio";"None";"RequiredFieldValidatorEvaluateIsValid";"";

va
WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1.showmessagebox =
WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1.showsummary
=
WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1 =
document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1");"True";"False";
//]]>
</script>

How can I solve this problem?

Thanks in advance.

Luigi
 
P

Patrice

Hello,
<script type="text/javascript">
//<![CDATA[
var
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.controltovalidate
=
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.display
=
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.evaluationfunction
=
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.validationexpression
=
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID
= document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID");"WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateTextBoxID";"Dynamic";"RegularExpressionValidatorEvaluateIsValid";"^\\s*(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))\\s*$";

The statement ends after ...
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID");

Then the next statement is :
"WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateTextBoxID";
 
L

Luigi

Patrice said:
The statement ends after ...
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID");

Then the next statement is :
"WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateTextBoxID";

Yes, the complete script is:


<script type="text/javascript">
//<![CDATA[
var
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID
= document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID");
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.controltovalidate
= "WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateTextBoxID"
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.display = "Dynamic"
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID.validationexpression
= "^\\s*(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))\\s*$";
var
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID
= document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID");
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID.controltovalidate
= "WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateTextBoxID"
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID.errormessage = "Campo [Data] obbligatorio"
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID.display = "None"
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidatorID.initialvalue = "";
var WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1 =
document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1")
WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1.showmessagebox = "True";
WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1.showsummary
= "False";
//]]>
</script>
 
G

Guest

Patrice said:
The statement ends after ...
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data _dateRegularExpressionValidatorID");
Then the next statement is :
"WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateTextBoxID";

Yes, the complete script is:

<script type="text/javascript">
//<![CDATA[
var
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionVal idatorID
= document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegula rExpressionValidatorID"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data _dateRegularExpressionValidatorID");
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionVal idatorID.controltovalidate
= "WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateTextBoxID";
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionVal idatorID.display = "Dynamic";
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionVal idatorID.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionVal idatorID.validationexpression
= "^\\s*(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))\\s*$";
var
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidat orID
= document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequir edFieldValidatorID"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Data _dateRequiredFieldValidatorID");
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidat orID.controltovalidate
= "WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateTextBoxID";
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidat orID.errormessage = "Campo [Data] obbligatorio";
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidat orID.display = "None";
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidat orID.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRequiredFieldValidat orID.initialvalue = "";
var WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1 =
document.all ?
document.all["WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSumma ry1"]
:
document.getElementById("WebCustomControl11_ucRicostruzioneMisure.ascx_Vali dationSummary1");
WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1.showmessag ebox = "True";
WebCustomControl11_ucRicostruzioneMisure.ascx_ValidationSummary1.showsummar y
= "False";
//]]>
</script>

What is this?

WebCustomControl11_ucRicostruzioneMisure.ascx_Data_dateRegularExpressionValidatorID

You are trying to create a variable with such long id and a dot in the
name? If it's a name of existed control on the page, then what does
"var" in front of the line?
 
M

Mark Rae [MVP]

In the Production environment, there is IE 6.

Surely not! IE6 is now *completely* unsupported by Microsoft, as well as
being generally acknowledged as the worst version of any browser ever
released by any company, not just Microsoft...

In my machine I have the version 8.0.
Maybe is here the problem?

The problem is that you are using document.all - use document.getElementById
instead

Also see the advice from Patrice...
 

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

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top