473,696 Members | 1,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please help: Validating input from a combination of controls

Hi,

I'm developing a search facility for my web app. In order for the
search criteria to be valid the user must (a) enter some text in a
text box and check and least one checkbox (of which there are two)
and/or (b) select at least one item from a multiple select list box.
I've written the javascript to do the client side validation which
gets called on the click event of my search button. I'd like to
implement server side validation using the validation controls but am
not sure how to achieve this. Can the custom validation control be
used in this instance (i.e. to validate the input from multiple
controls). If so how?

Thanks,

Paul
Nov 18 '05 #1
1 1520
Yes, a CustomValidator can be built to describe the same logic on the server
side as on the client side. The trick is to avoid having it valid except
when this particular button is pressed. In this case, I'd avoid using the
Page.Validate() method which is automically called when the submit button's
CausesValidatio n = true. Instead, I'd hook up that button's Click event
handler and have it call Validate() on the CustomValidator . Set the button's
CausesValidatio n to false. If CustomValidator .IsValid is false, regenerate
the page without saving data.

This scenerio is a very common one that requires something called
"Validation Groups". ASP.NET 2.0 (Whidbey) will eventually have this
feature. In the meantime, I offer a commercial product that supports
Validation Groups and building the extensive logical case you describe
without coding. In fact, with my validators, it will generate the correct
JavaScript for you and it will work on IE, IE/Mac, Netscape 6+, Mozilla,
Opera 7 and Safari (whereas Microsoft's client-side validation is IE
specific.) My product is "Profession al Validation And More". Learn more at
http://www.peterblum.com/vam/home.aspx.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com

"Paul" <pa********@hot mail.com> wrote in message
news:ca******** *************** ***@posting.goo gle.com...
Hi,

I'm developing a search facility for my web app. In order for the
search criteria to be valid the user must (a) enter some text in a
text box and check and least one checkbox (of which there are two)
and/or (b) select at least one item from a multiple select list box.
I've written the javascript to do the client side validation which
gets called on the click event of my search button. I'd like to
implement server side validation using the validation controls but am
not sure how to achieve this. Can the custom validation control be
used in this instance (i.e. to validate the input from multiple
controls). If so how?

Thanks,

Paul

Nov 18 '05 #2

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

Similar topics

20
2673
by: titi | last post by:
Question The road and traffic authority for a small country currently uses a system to store information about all 'currently' licensed drivers. A licensed driver has the following info stored about them in a record; 1. Given name(s) of the license holder.(not more than 128 char (may have spaces)). 2. Surname of the license holder.(Not more then 128 same like above).
7
3609
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
3
1160
by: Default | last post by:
Hi, The problem is laughably simple: I have a text box which must accept only numbers (on aim to restrict some extremely "talented" users to write, for example "blahblahblah" instead of 234); In C++ that is not a problem. As soon as you link some variable with dialog item, for example link a text box with some integer, the compiler restricts user to enter any char in above box, except numeric. in more subtle cases, one may use IsAlpha,...
0
852
by: ani | last post by:
I have a datalist control in my aspx page(this is paginated and everytime submits to itself). I am calling a function within my datalist that returns a html control (radio button ) in the form of the string. I also have asp server controls(labels) in the datalist. When the form is processed, I am retrieving the values of the radio buttons through Request.form. To retrieve the values of the asp server controls , I am using FindControl...
2
1346
by: Osmosis | last post by:
I have a form with several controls, which all have their validating and validated events in my code. However, if these controls don't get focus, these events don't get called. When my OK button is pressed, I need all the controls to be validated. How can I get this done ? Do I have to call the events individually for each control, and if so, how do I do this ?
2
2124
by: Chris Dunaway | last post by:
I have a form with a textbox and numerous panels, buttons and other controls. I have handled the textbox Validating and Validated events. The textbox will hold a filename. In the validating event, I check that the string in the textbox is a file that exists or whether or not the string is blank and display a message box in either case. I also call e.Cancel so that the value will be corrected. However, certain buttons on the form...
0
2462
by: Matthew | last post by:
All, I have searched google and the newsgroups but can't find anything the same as what I am experiencing (though I may have missed something). I have controls (textboxes) within UserControls which are not behaving as I would expect. Specifically, if there is a command button external to the usercontrol which is activated by a shortcut key (eg Alt-B), the command button Click event handler code 'executes' even though the textbox set...
0
2435
by: Gary Shell | last post by:
I am experiencing some strange behavior between a UserControl's validating event and a treeview control. Initially, I thought it was related to an issue in the Knowledgebase article 810852 (http://support.microsoft.com/kb/810852), but then I realized that the hotfix mentioned was in .Net v1.1, which I am using. I took the sample from that article and recreated the situation I see in my application. (Code included below.) If you run the...
7
1755
by: Bruce HS | last post by:
I'd like to call my ancestor Validation Function every time any control on a Win Form generates a Validating or Validated event. I'm using VB. I've extended Textbox, for instance, to have its events do this for me, but my extended textbox doesn't get created by those wonderful form setup wizards. So, 1) Is there a way I can pick up these events without having to code for each control and without using custom extended controls, OR
0
8656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8592
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
9141
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
8846
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...
1
6512
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4605
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3025
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2306
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1989
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.