473,890 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please help. Validate only selected controls

Hi,

I hope somebody can help me with the following. (I have tried
searching for a solution on the newsgroups but nothing is quite what I
need. Feel free to point me in the direction of anything I may have
missed though.)

I have a form with 2 text boxes, two list boxes and 2 buttons (A & B).
Both buttons must perform some validation but they differ in their
extent. Button A must ensure that a date has been entered in both text
fields and that at least one item has been selected in one of the list
boxes (it is always the same one). Button B however must ensure that a
date has been entered in both text fields and that at least one item
has been selected in each list box. Button A serves to populate the
other list box based on the values in the text boxes and the selected
item in the list box. Button B serves to submit the form when it is
totally complete.

I have added the necessary validation controls (i.e. combination of
RequiredFieldVa lidators, RangeValidators and CompareValidato rs) to my
form so that all fields are validated when Button B is clicked. What
can I do so that if Button A is clicked that only the text boxes and
one list box is validated. The EnableClientScr ipt property of each
validation control is true so the form is validated client side and
this is something I'd like to maintain. I'm using a validation summary
control to display error messages.

Any help would be appreciated.

TIA

Paul
Nov 18 '05 #1
2 1636
This sounds like a case where you need ASP.NET 2.0's "Validation Groups".
You would define unique names for each group of validators that you want to
fire. Assign those names to the Groupname property on validators and the
buttons. Yet, ASP.NET 2.0 will not be shipping for a while. Don't give up
hope though. Validation Groups is available in commercial validation
products. Mine is "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

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

I hope somebody can help me with the following. (I have tried
searching for a solution on the newsgroups but nothing is quite what I
need. Feel free to point me in the direction of anything I may have
missed though.)

I have a form with 2 text boxes, two list boxes and 2 buttons (A & B).
Both buttons must perform some validation but they differ in their
extent. Button A must ensure that a date has been entered in both text
fields and that at least one item has been selected in one of the list
boxes (it is always the same one). Button B however must ensure that a
date has been entered in both text fields and that at least one item
has been selected in each list box. Button A serves to populate the
other list box based on the values in the text boxes and the selected
item in the list box. Button B serves to submit the form when it is
totally complete.

I have added the necessary validation controls (i.e. combination of
RequiredFieldVa lidators, RangeValidators and CompareValidato rs) to my
form so that all fields are validated when Button B is clicked. What
can I do so that if Button A is clicked that only the text boxes and
one list box is validated. The EnableClientScr ipt property of each
validation control is true so the form is validated client side and
this is something I'd like to maintain. I'm using a validation summary
control to display error messages.

Any help would be appreciated.

TIA

Paul

Nov 18 '05 #2
Hi Peter,

I look forward to being able to use validation groups when we upgrade
to ASP 2.0.

I did get around this in the end by setting the CausesValidatio n
property of Button A to false then adding javascript that would get
executed on its click event

ButtonA.Attribu tes.Add("onClic k", "return validateForm(); ")

The javascript would only validate certain controls. It used many of
the functions and objects present in the mini-API that you can use on
the client, for example ValidatorValida te, ValidatorEnable ,
Page_IsValid, Page_Validators etc.

On the server side I just disabled certain validation controls before
calling the page validate method.
Nov 18 '05 #3

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

Similar topics

6
2171
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I don´t know much javascript so I wrote a very simple one to validate a form I have on my webpage. could you please have a look at the following script: ------------------------------------------------------------
3
2264
by: cdj | last post by:
Hi all, I've got a tabControl, initially with one tabPage, along with two buttons, one to add another tabPage, and one to delete the current (selected) tabPage. On each tabPage, when it is created, is an pictureBox. Other stuff on the form leads to the creation of a graphic, say myImage, which I would like to assign to the pictureBox.Image property
7
2178
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require. Below is the script I currently use and what it does along with what I would like it to do. Can someone please help me work how I can fix this. <script> function ValidateDropDownOrCheckBox(sender, args) { if ( document.forms.DropDownList1.value...
1
1533
by: Paul | last post by:
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...
4
2215
by: Pacific Design Studios | last post by:
I have a DataGrid on Form1 that displays a small amount of information about employees. On Form2 I want to have all the data displaying in text boxes about the employee selected in the datagrid on form 1. Is there a Id in the datagrid I can use to find out which user was selected or which record was highlighted when double clicked. Something like: John Thomas Employee Id 2637 was selected on Form1 and the recordset on Form2 would use...
1
1969
by: Kum | last post by:
Hi, I need help in asp.net dynamic textbox controls validation. I am creating textbox controls dynamically on a asp.net webpage. Now after creating the textboxes on the page I want to validate these text boxes when the user submits or posts back to the server. My intention was to create a textboxvalidator function which takes the control name as argument and returns an true if
1
2252
by: sab | last post by:
Hi, We have a web form with a listbox. The listbox is a multiple select listbox and has data that looks something like: ALL Unit 1 Unit 2 Unit 3 Note: "ALL" is always the first item in the list.
2
1169
by: J-P-W | last post by:
Hi I'm a VB bloke really, but need to use javascript from time to time. I have a form an validate it as follows: ~~~~~~~~~~ function Validate() { if (QuotePart2.SubsidenceCover.Value=="Yes" && QuotePart2.Buildings.Value=="") {
3
1603
by: Robert Dufour | last post by:
I am trying to localize a very simple web site (english and french) I have a master page and one content page for now. On the master page I have placed a Localize control On the content page I have placed a label and a dropdownlist. The label says "Use this language" or "Utilisez cette laague" The dropdownlist Contains values "en-US" text Englsih Us and "fr-CA" text "French Canada)
0
9822
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
11232
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
10819
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
9633
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...
1
8016
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
7169
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5851
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...
2
4271
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3277
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.