473,472 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Modifying a customValidator error message from the client function?

I'd like to be able to modify the error message of an ASP.NET 2.0
customValidator on the fly, depending on what part of the validation
failed. Now, the client validation function takes two parameters, the
second of which points to the value to be validated (args.Value). I
can't seem to locate what exactly the first parameter points to, and
trying to debug the Javascript in Visual Studio 2005 and figure this
out is problematic at best.

Is it possible to reference the ErrorMessage field of the
customValidator, or will I *shudder* need to roll my own custom field
validation?

Damon

Mar 17 '06 #1
1 1483
Damon wrote:
I'd like to be able to modify the error message of an ASP.NET 2.0
customValidator on the fly, depending on what part of the validation
failed. Now, the client validation function takes two parameters, the
second of which points to the value to be validated (args.Value). I
can't seem to locate what exactly the first parameter points to, and
trying to debug the Javascript in Visual Studio 2005 and figure this
out is problematic at best.

Is it possible to reference the ErrorMessage field of the
customValidator, or will I *shudder* need to roll my own custom field
validation?


*bump*

Still having trouble with this.

Here's my javascript validation code for one of the fields. This isn't
the final form of the validation, though. I want to check more stuff
but I need to get this question answered first.

function validateEditClient(val, args) {
args.IsValid = (args.Value.length > 0) && (args.Value.length <=
100);
if (!(args.IsValid)) {

document.getElementById('ctl00_ContentPlaceHolder1 _DetailsView1_txtEditClient').style.backgroundColo r='red'
} else {

document.getElementById('ctl00_ContentPlaceHolder1 _DetailsView1_txtEditClient').style.backgroundColo r='white'
};
}

I know what to do with the "args" parameter. But where, oh where is
there any documentation on what's being passed in the "val" parameter??

I want to be able to use it to programmatically reference the text
that's contained in the ErrorMessage property (or alternatively the
Text property) of the customValidator object. How can I do this?

Damon

Mar 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Együd Csaba | last post by:
Hi, I've a problem with some of my stored procs. My config is: RH7.1, Postgres 7.3.2 I had converted a few fields of a few tables from one type to another and after this I made all the...
2
by: Stephen Miller | last post by:
Can the CustomValidator be used to simply report unexpected errors, without requiring Client/Server validation? To explain, say you had a simple text box and button that did a Full-text Search of a...
1
by: Dorte | last post by:
Hi I am using a customvalidator to perform server validation of user input in webform1. When the user input has been validated, webform1 (which has the customvalidator and the user input) opens a...
3
by: Ronan Dodworth | last post by:
Hi there I'm having a little bit of a problem with my customvalidator control. The problem is the javascript runs fine on my local webserver IIS but not when I post it to the web hosting server....
1
by: Dan Sikorsky | last post by:
I'm getting the following message when I try to add a CustomValidator control to the ValidationSummary to display an error message at runtime, and displaying ex.message in AddValidationControl...
1
by: Luke Morehead | last post by:
We want to require a value for CboCharity if the value for cboCardSource = Fundraiser. Here's the client script: <script language="javascript"> <!-- function ValidateCharity(source, arguments)...
3
by: Eric Layman | last post by:
Hi, Are there ways for customvalidator to have 2 different error messages? eg: i have 2 conditions to check using customvalidator depends on condition, i would need to return 2 different...
3
by: Stan SR | last post by:
Hi, I have a web user control that contains 3 dropdownlists it's a date selector, so one contains the days, one the months and the last the years. Each of them starts with a blank value. I...
2
by: Epetruk | last post by:
Hello, I have an ASP.NET page which consists of a button (cmdSave), a label (lblMessage), a text field (txtName) and a custom validator (vldName). vldName is supposed to do both client *and*...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.