473,769 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1314
Below is an example of the error validation code that I need to implement
for one of the controls.
Private Sub cvEffDate_Clien tValidate(ByVal source As System.Object, ByVal
args As System.Web.UI.W ebControls.Serv erValidateEvent Args) Handles
cvEffDate.Serve rValidate

If Convert.ToStrin g(txtEffectiveD ate.Text).Lengt h = 0 Then

cvEffDate.Error Message = "Please enter an Effective Date."

args.IsValid = False

Else

Select Case Convert.ToDateT ime(txtEffectiv eDate.Text)

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

cvEffDate.Error Message = "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.Error Message = "The Effective Date is more than three months from
the current date."

args.IsValid = False

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

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

args.IsValid = False

Case Is < #7/1/2004#

cvEffDate.Error Message = "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
2710
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 that the custom control cannot be wired automatically to the calendar control, but i cannot seem to "read" the value of the calendar control via jscript via any other means. Any ideas?
2
3921
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 javascript checks for things like valid e-mail addresses or phone numbers (without having to add a separate control for validation). One idea I did some work on was having the control implement the IValidator interface and basically recreating...
2
3734
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 all the messages to a message box (ShowMessageBox=true). The required field validation error messages show up in the summary just fine but I can't get the custom validation message to show up if invalid. So far I have the summary control...
5
2647
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 in 1.1 since I could edit the .js file. Now in 2.0 I can no longer do this. Also, my code would have to be called after all client-side validation was done and was successful. Any ideas? TIA!
1
301
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 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...
1
9651
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 and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
0
1063
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 controls. All controls has the same validation group. When I press button for this validation group then all validations runs ok except custom validation. When this push button is removed from validation group then custom validation runs ok but...
3
8249
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, even if I force the customvalidator to validate by invoking its validate() method after a button is clicked: cvCustomValidator_ServerValidate(object source, system.Web.UI.WebControls.ServerValidateEventArgs args) <== doesn't get
0
1393
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' buttons. If the user clicks 'OK', the TextBox gets populated with 'true' & if 'Cancel' is clicked, the TextBox gets populated with 'false'. Note that when the user first comes to the ASPX page that uses this custom control, the TextBox is empty. This...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10043
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9861
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.