473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Please help old vb programmer with custom validation control

Hi all.

I'm fairly new to VB.net, and I have very little experience with Javascript.
I'm trying to get a Client Side Custom Validator to work for many
interrelated controls. I'd like to check several fields and update the
Error Message on the fly, and then have at least one error message shown in
a message box.

How do I write the Javascript? Should it be in the html code behind the
form? Or do I use the append function? I've looked all over the web for an
example written with the append function, but I can't find anything
adaptable to my situation.

Any help is greatly appreciated!!

Sarah
Jul 21 '05 #1
1 1292
Below is an example of the error validation code that I need to implement
for one of the controls.
Private Sub cvEffDate_ClientValidate(ByVal source As System.Object, ByVal
args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles
cvEffDate.ServerValidate

If Convert.ToString(txtEffectiveDate.Text).Length = 0 Then

cvEffDate.ErrorMessage = "Please enter an Effective Date."

args.IsValid = False

Else

Select Case Convert.ToDateTime(txtEffectiveDate.Text)

Case Is < System.DateTime.Now.AddDays(1)

cvEffDate.ErrorMessage = "The Effective Date must be at least one day in
advance of current date."

args.IsValid = False

Case Is > System.DateTime.Now.AddMonths(3)

cvEffDate.ErrorMessage = "The Effective Date is more than three months from
the current date."

args.IsValid = False

Case Is < System.DateTime.Now.AddMonths(-3)

cvEffDate.ErrorMessage = "The Effective Date is more than three months prior
to the current date."

args.IsValid = False

Case Is < #7/1/2004#

cvEffDate.ErrorMessage = "The Effective Date must be July 2004 or greater."

args.IsValid = False

Case Else

args.IsValid = True

End Select

End If

End Sub
Jul 21 '05 #2

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

Similar topics

1
by: charliewest | last post by:
Is it possible to use the custom validation control to validate a calendar control via client-side script (in jscript)? I'm familiar with custom validation and client side script, and i am aware...
2
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
2
by: Barbara Alderton | last post by:
I setup some standard Required Field Validation controls and one Custom validation control on an ASP.NET page (within a user control) to validate text entry. I also setup a Summary Control to post...
5
by: | last post by:
Hi all, Has anyone been able to write some custom javascript on the onclick event of submit button to do certain things like disable submit button, only submit form once etc. This was a breeze...
1
by: Sarah Katon | last post by:
Hi all. I'm fairly new to VB.net, and I have very little experience with Javascript. I'm trying to get a Client Side Custom Validator to work for many interrelated controls. I'd like to check...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
0
by: Marek | last post by:
Hi all, I have custrom control with four elements: text box, regular expression validator, required field validator and custom validator. Next this control is dragged on to web site with several...
3
by: Andy | last post by:
Hi folks, I have a customvalidator control that works properly if it isn't contained in an ASP:TABLE. But, when I place it inside an ASP:TABLE, I find that _ServerValidate doesn't get fired,...
0
by: rn5a | last post by:
A custom control is derived from the WebControl class & encapsulates a TextBox & a Button. When the Button is clicked, the user is shown the JavaScript confirm dialog with the 'OK' & 'Cancel'...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.