473,609 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="btnClo se.enabled =
'false';if (typeof(Page_Cl ientValidate) == 'function') Page_ClientVali date();
if (typeof(Page_Cl ientValidate) == 'function') Page_ClientVali date(); "
language="javas cript" id="btnSave" class="button" style="width:68 px;" />

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.Attri butes.Add("oncl ick","btnClose. enabled = 'false';if
(typeof(Page_Cl ientValidate) == 'function') Page_ClientVali date(); ");

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 2081
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. CausesValidatio n 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****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Fourge" <fo*********@on line.nospam> wrote in message
news:19******** *************** ***********@mic rosoft.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="btnClo se.enabled
=
'false';if (typeof(Page_Cl ientValidate) == 'function')
Page_ClientVali date();
if (typeof(Page_Cl ientValidate) == 'function') Page_ClientVali date(); "
language="javas cript" id="btnSave" class="button" style="width:68 px;" />

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.Attri butes.Add("oncl ick","btnClose. enabled = 'false';if
(typeof(Page_Cl ientValidate) == 'function') Page_ClientVali date(); ");

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
1769
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 server using Page.IsValid to branching appropriately. This appears to be a Server 2003 issue that occurs on several machines. The behavior does not occur on Window2000 or XP.
2
2678
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 a table that is bound to the island (such that the rows are dynamically generated by IE from the XML data island), the validators do not work. If the table is not bound, the validators do work, but then I don't have the table iterating through...
14
6287
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) show the error message next to the control. For example, if the text field is empty with RequiredField Validator control, it can show the value in ControlToValidate property in two ways as I mentioned. Please advise. Thanks!
3
13123
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 how to do this, I created the script to do it and thought I would share it. Its a littel messy but does the job. If anyone has a better solution, please let me know. //Client Site Event Handler to put in Page_Load event...
1
5204
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 appear to be the result of double-clicking the submit button on the form. The form has three ASP:Button tags, each of which gets translated into INPUT TYPE="SUBMIT" HTML elements. One submits the form's data. One logs the user out. And the other...
5
1917
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 example if both UserID and Password text fields are required but neither is filled in, I'd like to display the error message (a dialogbox) "Please enter the User ID". And only after the user has filled in UserID, it will display "Please enter the...
1
2502
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 the java script validation as well as the click in code behind? How can this be done ? Can I call the code behind from the javascript function? If not can i have a separate procedure in C# file and call it from the javascript function? If so...
4
2714
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" ControlToValidate="vrg" Text="*" /> <asp:Button ID="Button1" runat="server" Text="go" />
2
3838
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 validation passes, run custom javascript. Or. 2. from my client side javascript to run Validation check and then perform remaining client side function. So in this case I'll use <input type="button">.
0
8579
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8555
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8232
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8408
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7024
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5524
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4032
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4098
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.