Solved

ASP.net CustomValidator client-side function not firing

Posted on 2004-09-03
5
1,246 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now