473,796 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp .net for validation question

Hi,

My first post here. I am a self-taught, very "green" web developer. It
is not the main focus of my job but required from time to time.

I am developing a web application that logs security incidents for my
company. Here is a little background on how it works. I am using ASP
..net and VB. The user first submits a new incident which has several
required and not required fields related to the incident. The new
incident is written to a SQL table. The primary key number is then
cached and the user is taken to a place where he/she can submit
people, properties, or attachments to go with this incident. These are
not required. (i have a feeling maybe this is bad design). So I have
one form with four submit buttons. One for incident, person, property,
and attachment. My problem is this:

When I use asp .net built in data validation it appears to validate
all the fields that come before the submit button I am using. So when
I submit an incident it doesn't flag me for say, a person's name being
blank because this is later in the form. If a user does not want to
enter a person, but wants to enter a property, he/she gets an error
that he did not put a name in for the person. I don't want this to
happen. The name is only required if a person is submitted.

I would like to know if there is a way to do this with the built in
validation on the same form? One of my requirements was to do this all
on one page, and the incident has to be submitted before I can add
people, properties, and attachments to it.

Whew....hope that makes sense. Thanks in advance.
Nov 18 '05 #1
2 1551
Set all your validators to server side only and disabled, then depending
on which form is submitted enable those validators with your code - once
this is done call Page.Validate() and then you can check Page.IsValid ;)

Additionaly you may wish to use some div tags that "runat" "server", then
you can hide the form areas that are not able to be submitted when they
are creating the incident, and then hide the incident form once they have
submitted it - showing the second stage.
- Mark

On 30 Aug 2004 12:24:19 -0700, Matt Mercer <ma******@bells outh.net> wrote:
Hi,

My first post here. I am a self-taught, very "green" web developer. It
is not the main focus of my job but required from time to time.

I am developing a web application that logs security incidents for my
company. Here is a little background on how it works. I am using ASP
.net and VB. The user first submits a new incident which has several
required and not required fields related to the incident. The new
incident is written to a SQL table. The primary key number is then
cached and the user is taken to a place where he/she can submit
people, properties, or attachments to go with this incident. These are
not required. (i have a feeling maybe this is bad design). So I have
one form with four submit buttons. One for incident, person, property,
and attachment. My problem is this:

When I use asp .net built in data validation it appears to validate
all the fields that come before the submit button I am using. So when
I submit an incident it doesn't flag me for say, a person's name being
blank because this is later in the form. If a user does not want to
enter a person, but wants to enter a property, he/she gets an error
that he did not put a name in for the person. I don't want this to
happen. The name is only required if a person is submitted.

I would like to know if there is a way to do this with the built in
validation on the same form? One of my requirements was to do this all
on one page, and the incident has to be submitted before I can add
people, properties, and attachments to it.

Whew....hope that makes sense. Thanks in advance.

Nov 18 '05 #2
It sounds like you need the feature called "validation groups" which is
coming in ASP.NET 2.0 (due in Spring of 2005 and available today in Beta 1
from Microsoft). This allows you to assign a group name to each button and
the validators it fires.

Without it, the description given by Mark Harris makes sense: validating on
the server side only. I recommend leaving validators enabled. Instead, I
recommend in the Click event for each button, call the Validate() method on
individual validators that are involved. Then test each validator's own
IsValid property and continue if all are true.

I offer a commercial solution for this problem that provides validation
groups and works fully on the client side: "Profession al Validation And
More" (http://www.peterblum.com/vam/home.aspx).

There are many limitations in Microsoft's validator controls. I've put
together a list of them at http://www.peterblum.com/vam/valmain.aspx to help
people plan their validation designs.

--- 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

"Matt Mercer" <ma******@bells outh.net> wrote in message
news:37******** *************** ***@posting.goo gle.com...
Hi,

My first post here. I am a self-taught, very "green" web developer. It
is not the main focus of my job but required from time to time.

I am developing a web application that logs security incidents for my
company. Here is a little background on how it works. I am using ASP
.net and VB. The user first submits a new incident which has several
required and not required fields related to the incident. The new
incident is written to a SQL table. The primary key number is then
cached and the user is taken to a place where he/she can submit
people, properties, or attachments to go with this incident. These are
not required. (i have a feeling maybe this is bad design). So I have
one form with four submit buttons. One for incident, person, property,
and attachment. My problem is this:

When I use asp .net built in data validation it appears to validate
all the fields that come before the submit button I am using. So when
I submit an incident it doesn't flag me for say, a person's name being
blank because this is later in the form. If a user does not want to
enter a person, but wants to enter a property, he/she gets an error
that he did not put a name in for the person. I don't want this to
happen. The name is only required if a person is submitted.

I would like to know if there is a way to do this with the built in
validation on the same form? One of my requirements was to do this all
on one page, and the incident has to be submitted before I can add
people, properties, and attachments to it.

Whew....hope that makes sense. Thanks in advance.

Nov 18 '05 #3

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

Similar topics

2
2153
by: wumingshi | last post by:
Hi, When validating an XML instance, sometimes the schema is not enough to expression the validation rules. Additional validation rules may be expressed in an application-specific way. For example, using XPath or Java method. So is there a concept and/or standard for post-schema validation or application validation? Is there any hook in XML standards that allow me to hook up with my customized validation? Additionally and more...
9
2341
by: rbronson1976 | last post by:
Hello all, I have a very strange situation -- I have a page that validates (using http://validator.w3.org/) as "XHTML 1.0 Strict" just fine. This page uses this DOCTYPE: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> When I change the DOCTYPE to (what should be the equivalent):
16
2253
by: Hosh | last post by:
I have a form on a webpage and want to use JavaScript validation for the form fields. I have searched the web for form validation scripts and have come up with scripts that only validate individual fields, such as an "Email Validation Script" or a "Phone Validation Script". Is it ok to put all these scripts on page as they are or should they be joined in some way together to be one script? I'm a total JavaScript newbie and am completely...
1
1633
by: Colin Basterfield | last post by:
Hi, I have a web form which takes daily sales totals, both counts and monetary value and is done on a weekly basis, so on a Monday morning the User would enter these totals. Each total has a range, which at the lower end is >= 0 and the upper limit is configurable, these totals are then submitted to a web service which posts them to a data store. The question is regarding validation, obviously I can validate on the web form using...
14
6312
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2) show the error message next to the control. For example, if the text field is empty with RequiredField Validator control, it can show the value in ControlToValidate property in two ways as I mentioned. Please advise. Thanks!
5
3248
by: Chris | last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a datagrid I utilize the footer to create the 'add' row. The only issue is that I have it sharing the 'UpDate_Command' and I use an argument to difference between an 'edit' vs. and 'add. But since I have field validation on both 'footer' and 'edit' columns I can't submit my edits since the footer validation kicks in.If I take the validation off then the both work fine...
8
1204
by: Joe | last post by:
Hi, I have a form with three text fields and a Submit button. The two text fields have ReqiredFieldValidator and third text field has RegularExpressionValidator. The page validation works fine in Internet Explorer but I noticed that in FireFox, Netscape and Mozilla, they don’t work. These validation controls are set to run servside then why they don’t work in non-IE browser.
2
9106
by: winnie_us99 | last post by:
Hi All, I am trying to do validation on my text field before going to the next page to create a user. It doesn't look like the next button will fire any validation. Am I missing something? Can anyone please help me with this? I am attaching my code piece. Thank you in advance for your help. Wing
9
4181
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be honest I usually hire someone to do it for me, grab predone scripts and kind of hack out the parts that I need, or just do very minimal validation (e.g. this is numeric, this is alpha-numeric, etc.)
27
4759
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it appears that the data goes straight to the processing page, rather than the javascript seeing if data is missing and popping up an alert. I thought it may be because much of the form is populated with data from the db (lists, etc.), but when I leave...
0
9684
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
10459
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
10236
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...
1
10182
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9055
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
6793
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
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
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.