Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 30th, 2005, 01:32 PM
Authorized User
 
Join Date: Jul 2005
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.

 
Old August 30th, 2005, 06:39 PM
Friend of Wrox
 
Join Date: Jan 2004
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
 
Old August 31st, 2005, 09:24 AM
Authorized User
 
Join Date: Jul 2005
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.

 
Old September 1st, 2005, 06:05 PM
Friend of Wrox
 
Join Date: Jan 2004
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





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





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