Button Doesn't Work on Panel with Validation Control

S

Spence Hackney

I have noticed that within my application my button controls do not
work when there are validation controls on the panel (even if the
validation controls are not visible, i.e. not showing an error with
the control they are validating). When I click the buttons they enter
the depressed state, but nothing happens.

Similar button controls work fine when on a page where their is no
validation. Also, I am only experiencing this issue on one out of
three web servers the application is on. I have checked and the
aspnet_client script directory is in the root directory of the
application.
 
J

John Saunders

Spence Hackney said:
I have noticed that within my application my button controls do not
work when there are validation controls on the panel (even if the
validation controls are not visible, i.e. not showing an error with
the control they are validating). When I click the buttons they enter
the depressed state, but nothing happens.

Similar button controls work fine when on a page where their is no
validation. Also, I am only experiencing this issue on one out of
three web servers the application is on. I have checked and the
aspnet_client script directory is in the root directory of the
application.

I've never noticed this. Could you post a small reproducer?
 
S

Spence Hackney

I found something else odd. If I use an imagebutton or a button the
event does not fire. However, if I use a linkbutton control on the panel
it does! Go figure!

Does this bring up any ideas?
 
S

Spence Hackney

Found something interesting. On my local server (where the code works)
the form tag on the client side code after the ASPX page has been
processed is:

<form name="Form1" method="post"
action="GradApplication.aspx?Mode=applicantedit&amp;ApplicationID=313"
language="javascript" onsubmit="ValidatorOnSubmit();" id="Form1">

The page on the new server that does not work contains:

<form name="Form1" method="post"
action="GradApplication.aspx?Mode=applicantedit&amp;ApplicationID=1"
language="javascript" onsubmit="if (!ValidatorOnSubmit()) return false;"
id="Form1">

Also, the page that works says:

function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["Form1"];
}
else {
theform = document.Form1;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}

The one that doesn't reads:

function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["Form1"];
}
else {
theform = document.Form1;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}

(Notice the enclosing brackets arounsd Form1.)

What is going on to cause the same ASP.NET application to produce
different output on two different servers? I checked and they are both
using the latest .NET Runtime (1.1.4322.573).

Thanks!
 
S

Spence Hackney

Eureka! I found that the problem was with the WebUIValidation.js file.

I changed the ValidatorCommonOnSubmit function to:

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

See the follwing for information:

http://thomasfreudenberg.com/blog/archive/2004/04/05/CommentProblemSolve
d.aspx

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=e72nxxFOEHA.2
704%40TK2MSFTNGP10.phx.gbl&rnum=1&prev=/groups%3Fq%3Dif%2B(!ValidatorOnS
ubmit())%2Breturn%2Bfalse%253B%26hl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3De
72nxxFOEHA.2704%2540TK2MSFTNGP10.phx.gbl%26rnum%3D1
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top