Submit with validation problem

A

Alphonse Giambrone

I have a simple login page that has two text boxes, two
requiredfieldvalidators, a couple of labels and a button. It has been
reduced down to almost nothing to troubleshoot the below problem.

Added to a project on development machine (Win XP Pro, IIS 5.1, CLR
1.1.4322), works fine.
Deployed to a shared web host (IIS 5.1, CLR 1.1.4322), works fine.

Added to different project on same development machine, works fine.
Deployed to 2nd shared host (IIS 6.0, CLR 1.1.4322), FORM DOES NOT SUBMIT!
Validators seem to be working as if I leave a textbox empty, the
validator(s) present the appropriate message and there is no message if
textboxes are filled in.

It seems to be a problem with the generated javascript.
I added "/aspnet_client/system_web/1_1_4322/WebUIValidation.js" to the
application root because I need to utilize functions in it.
This is the same for all instances.
I mention this because if I remove the js file, the form will submit
properly, but then my other pages that need it don't work.

Here is the generated page source (minus most of the html) from the host
where the page does NOT submit:
<body onload="document.frmLogin.txtUserName.focus();">
<form name="frmLogin" method="post" action="logina.aspx"
language="javascript" onsubmit="if (!ValidatorOnSubmit()) return false;"
id="frmLogin">

<script language="javascript"
src="/aspnet_client/system_web/1_1_4322/WebUIValidation.js"></script>

<script language="javascript">
<!--
var Page_Validators = new Array(document.all["RequiredFieldValidator1"],
document.all["RequiredFieldValidator2"]);
// -->
</script>
<script language="javascript">
<!--
var Page_ValidationActive = false;
if (typeof(clientInformation) != "undefined" &&
clientInformation.appName.indexOf("Explorer") != -1) {
if ((typeof(Page_ValidationVer) != "undefined") && (Page_ValidationVer
== "125"))
ValidatorOnLoad();
}
function ValidatorOnSubmit() {
if (Page_ValidationActive) {
return ValidatorCommonOnSubmit();
}
return true;
}
// -->
</script>
</form>
</body>

==================================================
Here is the generated page source (minus most of the html) from the host
(and my development machine) where the page DOES submit:

<body onload="document.frmLogin.txtUserName.focus();">
<form name="frmLogin" method="post" action="logina.aspx"
language="javascript" onsubmit="ValidatorOnSubmit();" id="frmLogin">

<script language="javascript"
src="/aspnet_client/system_web/1_1_4322/WebUIValidation.js"></script>
<script language="javascript">
<!--
var Page_Validators = new Array(document.all["RequiredFieldValidator1"],
document.all["RequiredFieldValidator2"]);
// -->
</script>
<script language="javascript">
<!--
var Page_ValidationActive = false;
if (typeof(clientInformation) != "undefined" &&
clientInformation.appName.indexOf("Explorer") != -1) {
if ((typeof(Page_ValidationVer) != "undefined") && (Page_ValidationVer
== "125"))
ValidatorOnLoad();
}
function ValidatorOnSubmit() {
if (Page_ValidationActive) {
ValidatorCommonOnSubmit();
}
}
// -->
</script>
</form>
</body>
============================================================

The differences I see are in the form's submit event and the function
ValidatorOnSubmit().

Does anyone understand what is going on?
How to solve?

TIA
 
S

Steven Cheng[MSFT]

Hi Alphonse,

From your description, you have a simple page which contains two textboxes
and two RequiredFieldValidator
Control to validate textboxes, also a button to submit the page. This
worked well on the dev machine winxp pro
iis5 and also ok on a win2k server machine
but the page can't be submit on a w2k3 machine with IIS6. You also menioned
that you have manually copy the /aspnet_client (clienside scripts) folder
from the other mahcine to the w2k3 server machine, yes?

As for the WebUIValidation.js file under the /aspnet_client root folder ,
it contains the clientside scripts which is required for the ASP.NET
valication control's clientside validation. Also, this file together with
other ASP.NET required clientside resources under the /aspnet_client root
folder can be installed via the "aspnet_regiis.exe" tool.

We should use the
aspnet_regiis -c command
to install the clientside resources for asp.net rather copy from other
machines. For detailed info on the aspnet_regiis tool, you can view the
following referece in msdn:

#ASP.NET IIS Registration Tool (Aspnet_regiis.exe)
http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfASPNETIISRegistrat
ionToolAspnet_regiisexe.asp?frame=true

So I sugggest you remove the /aspnet_client folder you manually copyed from
other machines and when to the .net's installed folder
%SYSTEM%\Microsoft.NET\Framework\v1.1.4322\
in commandline
and execute the
aspnet_regiis -c command to reinstall the clienside resources and test
again.

If you have anything unclear or have any new findings, please feel free to
post here. Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
A

Alphonse Giambrone

Steven,

Thanks for the reply.
If I read the article correctly, Aspnet_regiis.exe must be run from the
command line on the server.
This is not an option as it is a shared commercial host.
 
A

Alphonse Giambrone

Fixed it!

Finally got a friendly tech support person and he installed the client
script files and all works now.
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top