View Full Version : I dont want it to refresh

01-20-2003, 04:42 AM
ok, here's the problem.

i'd created a form, and tried some validation(checking of empty fields) on it and the validation will execute when the submit button is pressed.

When one or some of the fields is/are empty, JS will alert the user to input all fields.

HOWever, the broswer will refresh itself after the user clicked 'ok'.
N thus, all the input fields have to be entered again!! This is wrong n troublesome.

i need help that can provide me the codes or any website that illusarated this problem.

Bless the person who helps me(rookie)..

01-20-2003, 02:53 PM
Could you provide a link to your code or past the code here? We need to see your code to help you.

01-20-2003, 05:43 PM
do you have the event onsubmit in your <form> ?

01-21-2003, 02:21 AM
Im not using the onSubmit 'function', imstead, im using onClick.

this is part of my codes

//This will call from a .js file.
function Validation(offset)
if (validateDate(offset)&&checkIfEmpty(offset))
//Start of form.
<form name="offset" method="POST">

.... // all in put types/fields

//End of form.
<INPUT name="offset" type=submit value=Submit onClick="return Validation(this.form)"> </form>

If u guys need more info from me, plz kindly reply, i will post more of my codes up...

Thanx a million, guys....

01-21-2003, 02:26 AM
Try using onsubmit instead, and doing this:

if (validateDate(offset)&&checkIfEmpty(offset)) {
return true;
else {
return false;

I think you might benefit by reading this (http://hotwired.lycos.com/webmonkey/programming/javascript/tutorials/tutorial1.html) tutorial. :)

01-21-2003, 02:33 AM
Geez, that was awful quick... I just posted my message about 3 or 4 minutes ago! :)

01-21-2003, 02:33 AM
Thanks a lot, guys..

It works!!!!!!!!!!!!!

thank you.:thumbsup: :thumbsup: :thumbsup:

01-21-2003, 02:34 AM
Wow, somehow my reply got posted before the message. That's strange!