aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Prevent the page refreshing