This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Request goes to server" Watch "Request goes to server" New topic
Author

Request goes to server

Saurabh Naik
Ranch Hand

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


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

Joined: Jan 01, 2009
Posts: 874


Saurabh,

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

Joined: Jan 10, 2002
Posts: 60794
    
  65

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


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

Joined: Apr 24, 2008
Posts: 87
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41137
    
  45
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.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Request goes to server
 
Similar Threads
How to stop the onclick function running when onsubmit validation fail
Session Timeout
Strange behaviour of JSP file
Which server-side script takes the input from JavaScript in j2ee application
nested FORM