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 Prevent the page refreshing 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 "Prevent the page refreshing" Watch "Prevent the page refreshing" New topic
Author

Prevent the page refreshing

kavita vala
Ranch Hand

Joined: Jul 22, 2010
Posts: 42
I have a form and in that there are some fields .
When i was clicked on submit button javascript validation are applied on it
And if there is a field empty alert is displayed After that all form values are gone.
And form becomes blank.
How can i stop page refreshing automatically?

My javascript code is here



And html code is



Please help me for this issue.
Eswar Nec
Ranch Hand

Joined: May 02, 2010
Posts: 105
Use return keyword like




Wake up! Don't let your smile be snatched away by anybody!
Regards, Eswar
kavita vala
Ranch Hand

Joined: Jul 22, 2010
Posts: 42
Thank you so much Eswara.
Its really working good.
kavita vala
Ranch Hand

Joined: Jul 22, 2010
Posts: 42
It works for if some field is empty but in regular flow if
any user fill all the details then its not submit the value to the servlet
because i use return to the on click event .

If there is another way to stop refreshing if some fields are empty
and also my data will submit to servlet if all fields are filled.

Than please help me for that.
Eswar Nec
Ranch Hand

Joined: May 02, 2010
Posts: 105
kavita vala wrote:It works for if some field is empty but in regular flow if
any user fill all the details then its not submit the value to the servlet
because i use return to the on click event .
.


You mean , you can't receive the text filed value after use return keyword.
I think , Already you use the following code to pass text field value.

Then,
How to receive the text filed value?
Can you post that code here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Prevent the page refreshing
 
Similar Threads
Java script Validation in struts form
Query String Problem
Javascript not executing in WSAD test server
Handling Multiple Submits
document.forms[0].elements.focus() is not working in IE 7.0+ and FF 3.0