Custom Validator - Client Side script is not firing in one server


I am using the custom validator to validate something in the client side. It works fine in 3 different server. But it is not working fine in one server.

Is it depend on server enviornment?

My Code


<asp:CustomValidator id="cvCustVal" runat="server" EnableClientScript="True" ErrorMessage="The Application is required."ControlToValidate="ddlDropDown" ClientValidationFunction="fnValidate">*</asp:CustomValidator>

JavaScript Code

function fnValidate(source, arguments)


var DropDownValue = document.getElementById("ucCurrentControl322_ucPricing_ddlDropDown");

if (null != DropDownValue )


var iValue = new Number(DropDownValue[DropDownValue.selectedIndex].value);

arguments.IsValid=(iValue > -1);




arguments.IsValid = false;






4/1/2008 12:06:00 PM 93655 articles. 6 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 16
Get it on Google Play
Get it on Apple App Store

No.Check to see if you have javascript disabled in that server. 


~ Remember To Mark The Post(s) That Helped You As The ANSWER ~
4/1/2008 1:41:24 PM


But, my other javascript functions which are calling seaparately, not by customvalidator is working fine.

This javascript with customvalidator only not triggering.

 Do you have any idea why it is not triggering?



4/1/2008 1:57:51 PM

Even if there is a problem on the client-side, server side validation should still detect the problem. Unfortunately, you haven't setup the ServerValidate event on the customvalidator to support server side validation. Always do that. Also always test Page.IsValid is true in your button's Click event prior to saving or using the data.

Looking at your validator's code, you wrote something that could have been done with the RequiredFieldValidator. It detects a no-selection case on lists and dropdownlists.

--- Peter Blum
Creator of Peter's Data Entry Suite (formerly Professional Validation And More and Peter's Date Package) and Peter's Polling Package
4/1/2008 4:24:37 PM

Similar Artilces:

Listbox Validation
Hi, How can I validate a Listbox using custom validator in server side?... I want a validation to check so that the users cannot select more than 5 options. I'm using C# for code behind. OK.... Finally I got it... here is what I did.... public void Count_ListItems(object sender, ServerValidateEventArgs args) { int counter=0; foreach (ListItem li in LstIndustries.Items) { if(li.Selected) { counter=counter+1; } } if (counter>5 || cou...

Custom Validator server-side validation not being called
I have a custom validator but don't seem to be able to get the server-side validation routine to be invoked. The validator markup is <asp:CustomValidator ID="valTest" runat="server" ControlToValidate="txtTest" ErrorMessage="Error!" OnServerValidate="valTest_ServerValidate"></asp:CustomValidator> To isolate the problem, I have the control on a page that contains nothing except the validator, the txtTest textbox it is validating, and a button to postback the form, but on stepping through the page in the debugger, it's ap...

Custom Validation: Verifying the server side validation
I have a custom validation and I have got the client side java script to work. How can I test to make sure the server side subroutine works. Is there a way to force the page to use server side validation? Thanks for the help in advance. Irene Click on your validation control in your designer and use the properties window to set EnableClientScript to false. Reload your page and test...Jamie Kindred, CGA, MCSD...

System.Web.HttpException: A page can have only one server-side Form tag.
Exception Details: System.Web.HttpException: A page can have only one server-side Form tag. What could this error message mean? I don't have any <Form> tags in my page. The message is because you cannot have more than a single form tag with Runat=server. For some reason, ASP.NET really does think that you have more than a single form. Are you including files or using user controls with runat=server form tags?Starting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog Here is my code. What I tried before the error is connecting twice to a database. Could...

A page can have only one server-side Form tag
First: No I don't have multiple form tags. I have one and only one in the master page. NO OTHER. Here's the scenario: The form and the post back is happening on the master page.  If I only have one level of nesting in my master pages (i.e. only the main parent master page) everything is fine and dandy.  However if I have a second master page then the post back causes the above error even though the page displays correctly when there is no post back.  So this scenario works: Master Page with post back control ----------Default.aspx  But this doesn't Mast...

System.Web.HttpException: A page can have only one server-side Form tag.
have anyone had this error message before Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: A page can have only one server-side Form tag. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [HttpException...

System.Web.HttpException: A page can have only one server-side Form tag. What is the Solution
Hello Every One,i want to add two forms with runat server attribute on same page But i got error errorSystem.Web.HttpException: A page can have only one server-side Form tag.Any Solution to resolve this errorThnksKunal MehtaWeb professionals who refuse to update their skills and insist on using outdated methods can no longer be called web professionals. Why do you want to do so? I guess you are still using the classic ASP mentality, tell me what are your goals, we can find another way of doing them in ASP.NET Regards  Bilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MV...

A page can have only one server-side Form tag
I have a web user control in my web page.  The user control (ascx) consist of a text box and button. The web page consist of text boxes and buttons also.  Both pages have form tags with runat=server.  When I run the web page it comes up with the error "A page can have only one server-side Form tag." Both the user control and web page need the form tag with runat=server.  Is there a way I can code these pages where there won't be a conflict between the web user control and the web page? Thanks   JohnMo wrote:Both the user control and web page need the form tag wit...

Custom Validator Not Firing In One App, Firing In Other App
I'm very confused. I have two applications, one serious, one just for testing code (both on same machine). I have set up a required field validator and a custom validator in each. In the testing app, the process goes like this: - user clicks linkbutton - required validators (client-side only) fire as expected - user fixes required item, but makes it still not valid - user clicks linkbutton again - server-side validation fires - if args.IsValid = true, linkbutton_click event occurs - if args.IsValid = false, user is returned to page (through no effort in my code), a...

only one server-side form on one page problem
I have a master page with two contentplaceholder. In the top one, I put a loginStatus to show the status which requires a server-side form tag. The status will appear on each page with this setup. In the second one, I need to query on a database to display data on the page with sqlDataSource control and GridView control which require another form runat server. How do I make this happen? as I am getting "..only one server-side form is allowed on the page" error. First, you'd have all form controls inside the single form, then there are two new things in 2.0 that will help you:1) "...

2 script tags, Script Language="javascript" and Script runat="server" in a web form.
Where should i place the javascript portion in the webform if i already had my <script runat="server"> (VB) place afterthat? Mark up: i understand that it should have 2 script tags used in the web form.  <SCRIPT LANGUAGE="JavaScript"> var isNN = (navigator.appName.indexOf("Netscape")!=-1); ...etc</script> <script runat="server">     Dim x, iRow, iCol, noRec As Integer   Dim i As Integer ... etc. <script> <asp:Content ID="First" ContentPlaceHolderID="aad"...

i write the password requirment validation in custom validator. but custom validator not fired
i tried in custom validator for password requirement. but it is not fired . wat i did the mistake tell me.i enterd in pwd text box bellow 5 it is showing error and enter the correct and showing error. i think it is not fired <script language="javascript" type="text/javascript">function validate(source,argument) {var data=argument.Value.split(''); //start bysetting falseargument.IsValid=false; //checklengthif(data.length < 5 || data.length > 15) return;argument.IsValid=true; elseargument.IsValid=false; }   </script> <...

How to fire events in other web form from other web form ?
Suppose that I have A and B web form. I want to trigger B web form's Page_Load event from A web form. How can I do that ? Thanks in advanced WilbertWilbert Bujn Create a public method in B that call the load method : public void Load(object sender, System.EventArgs e) { Page_Load(sender, e) ; } In the page_load of A, instanciate a B object and then call the function B myB = new B() ; myB.Load() ; Quicky Thank you quicky, it works fine. WilbertWilbert Bujn...

Web form custom validation
Hi All...I wonder if anyone can help.  I have a simple issue, but am a bit stumped as to how to solve it.I basically have a form on a page that has 3 text boxes and 4 drop downs on it.  I am using .NET 2.0.  I basically need to detect that anyone of them has a value in it before submitting the form.  I dont care which one, just that one of them has been set.Do I need to use a custom validator for this?  If so, I am confused as to which control to assign the "ControlToValidate" option to detect, as I dont really care which one it uses.Any help or examples would be gre...

Server-Side custom validator
I'm new to dotnet and appologize for the basic question. I'm working in c#... I have a custom form field validator on a user name field. Here is the premise... In my Page_Load I run a stored procedure that adds a user. In the stored procedure it checks to see if the user name exists. If the user name exists, the stored procedure returns null otherwise it returns the new user id. After checking for null, I *want* to invalidate the custom control. So I have code like this... if (myCmd.Parameters["@o_NewID"].Value == System.DBNull.Value) { cvUserName.IsValid = ...

Web resources about - Custom Validator - Client Side script is not firing in one server -

CSE HTML Validator for Windows (Official Site) - Powerful HTML Validator, XHTML Validator, CSS Validator ...
CSE HTML Validator is a powerful and easy to use offline HTML, XHTML, CSS, JavaScript, and PHP syntax checker, HTML validator, XHTML validator, ...

DNSSEC/TLSA Validator is a web browser add-on which allows you to check the existence and validity of DNS Security Extensions (DNSSEC) records ...

Feed Validator for Atom and RSS
F E E D Validator for Atom and RSS and KML Jump to navigation RSS Profile Support Added ( more ) Home · About · News · Docs · Terms Copyright ...

Credit Card Validator on the App Store on iTunes
Get Credit Card Validator on the App Store. See screenshots and ratings, and read customer reviews.

Not fare: new myki card validators lack account balance information
New myki card validators will not tell passengers what their fare is, nor their account balance, leaving unable to monitor their myki use as ...

Mozilla launches new JavaScript-based Add-ons Validator for developers
... that the validation tool provided by Mozilla is unreliable and difficult to use. Today the company announces that the old Python-based validator ...

Business Insider Built An Awesome Analytics Validator And You Can Use It
At a fast-growing media company like Business Insider, keeping accurate analytics is absolutely essential. Editors rely on our analytics dashboard ...

Jon Voight, Validator of Right-Wing Frenzy
Jon Voight was once known for his acting chops and, later, for fathering Angelina Jolie. These days? Well, he's known for his rabid right-wing ...

chocolatey/package-validator · GitHub
package-validator - Windows service to validate packages conform to pacakge standards

Bing Webmaster Tools Adds Markup Validator
The Bing Webmaster Blog announced they have added a new feature to the crawl section named Markup Validator. To access this new feature, login ...

Resources last updated: 1/22/2016 3:26:13 PM