• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Request goes to server

 
Saurabh Naik
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
In my form there are 2 fields name and password. through java script function chek() I am checking it whether it is filled or not but I am executing that function on onclick event of submit button. so request goes to server. though I am returning false if I have not filled the fields. Is there any mechanism to stop the request without using ajax or without calling that function on another event.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Saurabh,

Post your code please. return false; would help in this case.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you post your code I am sure that we will see that you are returning false from the wrong place.
 
Saurabh Naik
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you calling this function in the onSubmit handler? It needs to be called like "return validate_email(...)", not "validate_email(...)".
Also make sure that you return something from that function in every case, not just in the negative.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic