• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

code not working properly

 
gaurav chhabra
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir
i m new to javascript ,,,i have some problem in the code below...

<!-- JAI SHRI RAM -->
<html>
<head><title>JAI SHRI RAM</title></head>
<SCRIPT LANGUAGE="JavaScript">
function ValidateForm(form)
{
if(IsEmpty(form.name))
{
alert('jai shri ram')
return false;
}
return false;
}
</SCRIPT>
<body>

<form name=form1 action = "http://localhost:8080/main_page1.jsp" onSubmit="return ValidateForm(this)">
<input type="text" name="name">
<input type="submit">

</body>
</html>

it is not working plz tell me the problem
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you expect it to do and in what way is it not working?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IsEmpty... WHERE is the function at?

Eric
 
H Wilson
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by gaurav chhabra:

if(IsEmpty(form.name))
{
alert('jai shri ram')
return false;
}
return false;


I notice that you are returning false whether IsEmpty() returns true or false. Is that really what you want to do? Perhaps that is the source of the problem. Otherwise it must be something in the IsEmpty() function. You would need to post that code here to get feedback.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic