Link to home
Start Free TrialLog in
Avatar of electricstory
electricstory

asked on

ASP.net CustomValidator client-side function not firing

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.
Avatar of glsac
glsac
Flag of United States of America image

Can you post the code please (just for reference)...
Avatar of electricstory
electricstory

ASKER


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.
ASKER CERTIFIED SOLUTION
Avatar of Rejojohny
Rejojohny
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well, I've given this weeks and no one's answered, so points to you Rejojohny. I know this SHOULD work.