473,408 Members | 2,405 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,408 software developers and data experts.

Validation advice

CK
Hi all,
I have a drop down list that is populated from a database table. During the
databind event I add a row to the beginning of the datatable and set that as
the source of the dropdown. it's value is "0".

I added a CompareValidator to make sure when the web form is submitted, that
the value of the drop down is greater than 0. Everything works great.

My question is, is it more appropriate to use a RequiredFieldValidator? If
so why? I thought this was a good use for the compare validator but my
development team thinks the RequiredFieldValidator is more appropriate.

Any comments are appreciated.

TIA,
CK
Mar 15 '06 #1
2 924
I would agree with your dev team and a good reason is for that maintenance
of the app. You may need to add another ListItem with a value of 0 somewhere
down the line. With a ListItem("name","") and a required validator, you'll
never need to ever change the code.
"CK" <c_**********@hotmail.com> wrote in message
news:uV*******************@newssvr14.news.prodigy. com...
Hi all,
I have a drop down list that is populated from a database table. During
the databind event I add a row to the beginning of the datatable and set
that as the source of the dropdown. it's value is "0".

I added a CompareValidator to make sure when the web form is submitted,
that the value of the drop down is greater than 0. Everything works great.

My question is, is it more appropriate to use a RequiredFieldValidator? If
so why? I thought this was a good use for the compare validator but my
development team thinks the RequiredFieldValidator is more appropriate.

Any comments are appreciated.

TIA,
CK

Mar 15 '06 #2
Hi,
Its fine with comparevalidator too...

But you can also use RequiredFieldValidator .... by setting its initial
value to 0

both provide functionality to place a check .... but its you choice which
you select
"CK" <c_**********@hotmail.com> wrote in message
news:uV*******************@newssvr14.news.prodigy. com...
Hi all,
I have a drop down list that is populated from a database table. During
the databind event I add a row to the beginning of the datatable and set
that as the source of the dropdown. it's value is "0".

I added a CompareValidator to make sure when the web form is submitted,
that the value of the drop down is greater than 0. Everything works great.

My question is, is it more appropriate to use a RequiredFieldValidator? If
so why? I thought this was a good use for the compare validator but my
development team thinks the RequiredFieldValidator is more appropriate.

Any comments are appreciated.

TIA,
CK

Mar 16 '06 #3

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

Similar topics

11
by: Paul Rubin | last post by:
I frequently find myself writing stuff like # compute frob function, x has to be nonnegative x = read_input_data() assert x >= 0, x # mis-use of "assert" statement frob = sqrt(x)...
6
by: Kaustubh | last post by:
Well i have checked my style shit with w3c validating service but it still showing some error the thing is i dont understand what shall i do to correct it i want some toool which ll correct my...
67
by: Scott Meyers | last post by:
I have a web site that, due to maintenance by several people, some of whom are fairly clueless about HTML and CSS, etc. (notably me), has gotten to the point where I'm pretty sure it's suffering...
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...
6
by: Stephen | last post by:
Hi, Does Validation controls like "Required field validator".... ever work with Netscape or we have to write javascript for either client-side or write server side validation. Please advice....
3
by: VB Programmer | last post by:
Can you make a required field validator optional? I know it sounds crazy, but.... Let's say I have a signup form. It consists of 2 sections. The top section is a "GOLD MEMBER" section. It...
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: John Chan | last post by:
Hi, Im doing a maintenance application in ajax and coldfusion at work on IE6 exclusively. I have a save button on each form and i have to do various validations server side and on client side...
10
by: gweasel | last post by:
What is the best way to apply a Validation Rule - or rather, where is the best place to put it? Is there an advantage to putting it on the field in the table vs setting the validation rule on the...
2
by: Sudhakar | last post by:
A) validating username in php as part of a registration form a user fills there desired username and this is stored in a mysql. there are certain conditions for the username. a) the username...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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...
0
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...
0
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...
0
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...
0
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,...
0
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...

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.