Closed Thread Icon

Topic awaiting preservation: Validating a from error (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8668" title="Pages that link to Topic awaiting preservation: Validating a from error (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Validating a from error <span class="small">(Page 1 of 1)</span>\

 
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 05-23-2003 02:28

Hi, guys. How are you?
Well, I have got another problem.

My mission:

User must enter both name and emial address into text box. Otherwise alert box says "please enter missing data".

Here is my code:

code:
<html>
<head>
<script type="text/javascript">
function isBlank(theForm)
{
if ((theForm.first.value == " " )&#0124; &#0124; (theForm.last.value == " "))
{
alert("Please enter missing data.")
}
else
{
theForm.submit()
}
}

</script>
</head>
<body >
<form>
<h3>Please enter your first name:</h3>
<input type="text" name="first"><br />
<h3>Your last name:</h3>
<input type="text" name="last"><br />
<input type="button" value="submit info" onClick="isBlank(this.form)">
</form>

</body>
</html>



I guess I have done enught to run the program. But alert box never pops up.....
Would you see why???

Many thanks.
Happy Friday.

Hiroki Kozai

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 05-23-2003 07:05

You've coded it so that the alert box will only pop up if one of the boxes contains a space (" "). If you submit the form with nothing at *all* (""), then there's no space, so the form is submitted.

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 05-23-2003 13:49

Hello,

Try to change to:

code:
if (!theForm.first.value.length &#0124; &#0124;  !theForm.last.value.length)





Elias

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 05-23-2003 13:50

"" instead of " "
Hmm....I did it.
But still doesn't work....
Well, anyway I am off to bed.
I am shifting tomorrow.
Have a good night.
Many many thanks for your reply, Slime.
Cya.

Hiroki Kozai

« BackwardsOnwards »

Show Forum Drop Down Menu