Solved

ASP.net CustomValidator client-side function not firing

Posted on 2004-09-03
5
1,262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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