?
Solved

ASP.net CustomValidator client-side function not firing

Posted on 2004-09-03
5
Medium Priority
?
1,270 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 1500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

801 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