472,354 Members | 2,221 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

Client Validation Javascript not rendering

Hi,
I have run into a very strange scenario. In developing an ASP.NET
application on framework version 1.1, I found that certain client-side
validation scripts were not being rendered. The reason we came up with for
this was because we had a PageBase base class for all our pages. This base
class takes the controls on the child page class and places them onto the
form being rendered. It seems that in this process, the rendering of the
validation calls gets lost. To overcome this problem I added code to add the
required client-side function call on the "onclick" event of the necessary
buttons as follows:

<input type="submit" name="btnSave" value="Save" onclick="btnClose.enabled =
'false';if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();
if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="btnSave" class="button" style="width:68px;" />

Can anybody tell me if the original problem was a bug in the framework, IIS5
etc.? Also, if it was a framework bug, why does it differ with the same
version on WinXP Pro and Win2003 Server?

Any light on this subject will be greatly appreciated.

Fourge
btnSubmit.Attributes.Add("onclick","btnClose.enabl ed = 'false';if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); ");

After adding this, it worked great in our development and test environment.
Our development is done on Windows XP Pro with IIS5 and our testing on
Windows 2000 Server with IIS5. Both environments running .NET Framework 1.1.

One of the deployments we did was into the Windows 2003 Server environment.
Once th application was running in that environment, we found that the
validation function calls above were now being added and so we were getting
the javascript calls twice in the rendered html page as follows:
Nov 19 '05 #1
2 2006
While there is a bug in client-side validation in ASP.NET 1.1 SP1, I don't
think it is involved here. That bug prevents the button click from ever
submitting the page. See
http://www.asp.net/Forums/ShowPost.a...&PostID=739537

If the button is not generating its onclick event code, there are two
possible reasons:
1. CausesValidation is false on the button.
2. The Page.Validators collection has no validators (or perhaps just
"active" validators where their Visible property is true.)

I don't know how your code moves controls around and wonder if it ends up
clobbering the Page.Validators collection.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Fourge" <fo*********@online.nospam> wrote in message
news:19**********************************@microsof t.com...
Hi,
I have run into a very strange scenario. In developing an ASP.NET
application on framework version 1.1, I found that certain client-side
validation scripts were not being rendered. The reason we came up with
for
this was because we had a PageBase base class for all our pages. This
base
class takes the controls on the child page class and places them onto the
form being rendered. It seems that in this process, the rendering of the
validation calls gets lost. To overcome this problem I added code to add
the
required client-side function call on the "onclick" event of the necessary
buttons as follows:

<input type="submit" name="btnSave" value="Save" onclick="btnClose.enabled
=
'false';if (typeof(Page_ClientValidate) == 'function')
Page_ClientValidate();
if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="btnSave" class="button" style="width:68px;" />

Can anybody tell me if the original problem was a bug in the framework,
IIS5
etc.? Also, if it was a framework bug, why does it differ with the same
version on WinXP Pro and Win2003 Server?

Any light on this subject will be greatly appreciated.

Fourge
btnSubmit.Attributes.Add("onclick","btnClose.enabl ed = 'false';if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); ");

After adding this, it worked great in our development and test
environment.
Our development is done on Windows XP Pro with IIS5 and our testing on
Windows 2000 Server with IIS5. Both environments running .NET Framework
1.1.

One of the deployments we did was into the Windows 2003 Server
environment.
Once th application was running in that environment, we found that the
validation function calls above were now being added and so we were
getting
the javascript calls twice in the rendered html page as follows:

Nov 19 '05 #2
Hi Fourge,

I'm also a bit interested in how your base pages adding those validation
controls. As far as I knew, the validation control will regsiter the
clientside script in their OnPrender event. So if we adding the validtion
controls correctly before Prerender, that should not be the problem.

I think we can first check whether the output page is correctly emiting the
validation's required script in page output and whether the script files on
the deployment server is correctly installed. As you mentioned that when
you're using the base page to adding those validation controls and the
validtion not work, have you tried viewing the page's output html code at
the clientside (via View source). You can have a look whether the script
codes are embeded correctly. If the code is correctly there, we may have a
check on the server's asp.net clientside script installation. Try
executing the
aspnet_regiis -c
command to reinstall the asp.net common script files on the server and test
again to see whether it works.

Anyway, I think it'll be better to start test from a simple page with a
textbox and a validtion control.

If there is any other 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.)

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: sadf | last post by:
We recently deployed several new ASP.NET apps to Windows Server 2003 and discovered that field validator controls render client-side script that does not execute! Validation takes place on the...
2
by: Dnna | last post by:
I have a table which is bound to an Internet Explorer XML data island. I'm using ASP.NET's client-side validators for an input field in the table. The problem is that if the input fields are in...
14
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
3
by: Earl Teigrob | last post by:
I wanted my "Terms and Conditions" Checkbox control to participate in my ASP.NET validation just like all the the other controls on the page. After some time of searching the web for an example of...
1
by: rmgalante | last post by:
I have written an ASP.Net application that uses the standard client-side and server-side validation for various fields on the form. Some of the customers that use the form report symptoms that...
5
by: Sun Jian | last post by:
Hi, I am trying to customize the asp.net validation to achieve the following: Upon submitting the form, client side validation will run, and it will stop at the first error detected. For...
1
by: vidya | last post by:
Hi, I have a button which is a web control. I have some validation in javascript for the button in .aspx file and some in the button onclick event in code behind(C#). I need to get through both...
4
by: Chris | last post by:
Hi, i want to validate a textbox like this: <asp:TextBox ID="vrg" runat="server" Width="495px" TextMode=MultiLine/> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"...
2
by: goscottie | last post by:
I need to find a way to either 1. run and check all Validation controls (in my case one CompareValidator) and run client side javascript function. In this case I'll use <asp:Button>. So if all...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.