Re: Will not SUBMIT if textbox empty
by "Steve Cost" <scost(at)neo.rr.com>
|
Date: |
Fri, 17 Nov 2000 17:14:19 -0500 |
To: |
"Shull, Conrad" <cshull(at)shscares.org>, <hwg-languages(at)hwg.org> |
References: |
ntmail1 |
|
todo: View
Thread,
Original
|
|
If you're willing to use JavaScript, the following is what I do:
function Inspect(form){
var dataIn0=document.forms[0].elements[0].value
if (dataIn0 == "")
{alert("You must enter a book title")
document.forms[0].elements[0].focus()
return false}
and then in the form tag:
<FORM METHOD="post" ACTION="BookEntry2.asp"
onSubmit="return Inspect(this.form)" id="form1" name="form1">
In this fashion, the form will not be submitted until the function Inspect()
returns true.
HTH,
Steve
----- Original Message -----
From: "Shull, Conrad" <cshull(at)shscares.org>
To: <hwg-languages(at)hwg.org>
Sent: Friday, November 17, 2000 11:46 AM
Subject: Will not SUBMIT if textbox empty
| Is there a way to keep a <form> from submitting if nothing has been
entered
| in an input textbox (actually, in this instance, a type="file" input box)?
| The <form action= > is the same page. I would like to have NO Request
| Object (ASP) initiated if the input has nothing entered (a file chosen for
| upload). I'm dealing with multiple forms on a single page and mixing
| BinaryRead method forms and Request.Form collections forms and have worked
| out how to keep one from interfereing with the other, but I just know
| someone is going to hit the SUBMIT button (BinaryRead) without selecting a
| file and give an ugly error page.
|
| - Conrad Shull
|
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA