473,383 Members | 1,929 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,383 software developers and data experts.

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 1523
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******@bellsouth.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: "Professional 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****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Matt Mercer" <ma******@bellsouth.net> wrote in message
news:37**************************@posting.google.c om...
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
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...
9
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...
16
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...
1
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...
14
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)...
5
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...
8
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...
2
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...
9
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...
27
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...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.