Submit fails when using Validation Controls

  • Thread starter Thread starter Andrew Winn
  • Start date Start date
A

Andrew Winn

Hi,

Got a problem with the required validation control not
posting back after a valid page is requested to be
submitted?

I have a login page with the usual Username and Password
fields and a login button. Validation control checks that
there is something in the fields before allowing a post
back.
Problem only occurs on my Test Server (it works fine on
my development server - both are Windows 2000 Advanced
Server - Test is SP4 Dev is SP3). When I click Login with
the fields missing it detects this and displays an error;
however when I complete the fields and click login
nothing happens (or appears too).
I have traced the code through to the JavaScript file
WebUIValidation.js. ASP.NET puts an onSubmit event
handler on the form tag which calls
ValidatorCommonOnSubmit which is in the
WebUIValidation.js file.

function ValidatorCommonOnSubmit() {
event.returnValue = !Page_BlockSubmit;
Page_BlockSubmit = false;
}


On both the Test and Development servers it puts a true
in the event.returnValue, but the Test server does submit
and therefore it doesn't go into the server side code for
the login button's onClick event.

I have had a similar problem in the past and removed
Smart Navigation which did the trick, however this time
it makes no difference if Smart Navigation is true or
false.

Any advice would be much appreciated

Regards,
Andrew
 
It sounds like there is some difference in the servers that you are talking
about.

First, I would check the HTML be generated by both servers, make sure they
are identical. In theory, identical HTML source files on the same browser,
should behave identically, as executing javascript is strictly a client side
issue.

Also, check the IIS logs on the test server, make sure that there is no post
happening, or if it just happens so fast that you don't notice.
 
Sorry Typo (does should have been doesn't) in para
below...

On both the Test and Development servers it puts a true
in the event.returnValue, but the Test server does'nt
submit
and therefore it doesn't go into the server side code for
the login button's onClick event.


Hope you can help?

Andrew
 
After ValidatorCommonOnSubmit(), the next step for the javascript is to run
the <form onsubmit=> event. That code tests if Page_BlockSubmit to determine
if it should stop. There is a bug in earlier v1.1 net in this place, where
it doesn't use "return" to return true or false. This breaks IE/Mac for sure
and may be affecting you. There is a hotfix for v1.1 ASP.NET located at
msdn.microsoft.com. I don't know the KB article number.

Also just look at the code for onsubmit. If it involves other code than
validation, a javascript error in that other code may stop the script from
executing, and keep the page from submitting.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 
Back
Top