File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Request goes to server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Request goes to server" Watch "Request goes to server" New topic

Request goes to server

Saurabh Naik
Ranch Hand

Joined: Apr 24, 2008
Posts: 87
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.

SCJP 6 (88%), SCWCD 5 (78%), preparing for SCBCD
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


Post your code please. return false; would help in this case.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

Once you post your code I am sure that we will see that you are returning false from the wrong place.

[Asking smart questions] [About Bear] [Books by Bear]
Saurabh Naik
Ranch Hand

Joined: Apr 24, 2008
Posts: 87
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
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.
I agree. Here's the link:
subject: Request goes to server
It's not a secret anymore!