Solved

ASP.net CustomValidator client-side function not firing

Posted on 2004-09-03
5
1,256 Views
Last Modified: 2008-03-17
Okay, I'm stumped. I've put a custom validator control on my page to check input in a textbox and written the javascript function with source, args parameters. The validator works fine on my workstation, but not when I access the same page with the same code that I've got on the remote server. The function is never called for some reason. I've got the javascript in a .js include file with several other javascript functions. I put alerts in those functions and reuploaded the .js file to make sure that I didn't have any path errors and that other events on the page were indeed pulling code from the same file that the validation function resided in. I've done a diff on the source for each output page, and I can't see anything. The web.config files are the same. Validation isn't turned off in either aspx page. I've tested with both Mozilla and IE.

I just can't pin down the variable.
0
Comment
Question by:electricstory
  • 2
5 Comments
 
LVL 9

Expert Comment

by:glsac
ID: 11984283
Can you post the code please (just for reference)...
0
 

Author Comment

by:electricstory
ID: 11984706

Here's the page code for the validator:
<asp:CustomValidator id="cvSearch" runat="server" ErrorMessage="No angle brackets." ClientValidationFunction="validateAngle" ControlToValidate="txtSearch"></asp:CustomValidator>

Here's the javascript function:

function validateAngle(source, args){
var strText = args.Value;
if (strText.indexOf("<")==-1) {
args.IsValid = true;
}
else
{args.IsValid=false;}
}

Like I said, it's fine on my workstation; it just doesn't work on my Web host's server.
0
 
LVL 26

Accepted Solution

by:
Rejojohny earned 500 total points
ID: 11987637
shouldn't this be
var strText = args.Value;

var strText = args.value; //javascript been case-sensitive

anyway the surprising thing is that u say the same code is working on another server and u have tested it on IE too ..
0
 

Author Comment

by:electricstory
ID: 12144778
Well, I've given this weeks and no one's answered, so points to you Rejojohny. I know this SHOULD work.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question