Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 30th, 2005, 01:32 PM
Authorized User
 
Join Date: Jul 2005
Location: New York, New York, .
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default Check for missing input

Any convention?

I have one form w/ 30 textboxes. Among them, about 13-15 are required.

Reply With Quote
  #2 (permalink)  
Old August 30th, 2005, 06:39 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Your question is vague and belongs in the javascript area of the forum. I will assume you are looking for a value that is <> ""?

1..Add the following event to your form tag
<form ... onclick="return validate();">

2..Here is the function, place this in the head of your page
<script>
function validate()
{
  if (document.FormName.fieldName.value == "")
  {
     alert("You must enter a value");
     document.FormName.fieldName.focus();
     return (false);
  }
  return (true);
}
</script>

NOTE: this will validate one field - replace the formName and fieldName with your own.


Wind is your friend
Matt
Reply With Quote
  #3 (permalink)  
Old August 31st, 2005, 09:24 AM
Authorized User
 
Join Date: Jul 2005
Location: New York, New York, .
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, mat41

But, I'm curious what if someone disables javascript...
Also how about other checking for others such as date/time, number?
I just worry about the dependability of javascript checking... Thanks again.

Reply With Quote
  #4 (permalink)  
Old September 1st, 2005, 06:05 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;disables javascript...
mmmm there are lots wierdos out there - client side validation is the most efficient, if are concerened about this minority you can do it on the server side. IMO - how many people fit into this category and do we need thier business.

;;;Also how about other checking for others such as date/time, number?
To check for an integer:
if(isNaN(parseInt(document.fName.fieldName.value)) )
{
   alert("not a valid number
   document.fName.fieldName.focus();
   document.fName.fieldName.select();
   return(false);
}

Dates : dont let them enter them manualy - give them a date picker then just check for ""

;;dependability of javascript checking
If its turned on it will work - all my form validation is done with JS

Youre welcome

Wind is your friend
Matt
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connect to VSS check-in Check-out Programatically rhd110 General .NET 6 August 12th, 2007 07:46 AM
Check-boxes on input form tmangus Access VBA 4 June 14th, 2005 11:40 AM
Need HELP!!! Record Input in Field - Check box on karlzoe BOOK: Beginning ASP 3.0 1 April 7th, 2005 09:51 AM
Check/Reconnect Missing References ErikTheProgrammer Access VBA 3 February 20th, 2005 02:47 PM



All times are GMT -4. The time now is 06:22 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.