View Full Version : Buttons

03-31-2003, 05:35 AM
Hi all

i have a page where there are some fields that is needed to be filled in before sending back to server(im using Java programmin here).

And i do have some validation(Using JavaScript) so to check that all fields are needed to be filled in(at least not blank) before submit.

So here's the problem. when clicking the "Submit" button, Fields that are not filled will be alert. This is good:o , but, i do have another button which is "Back".. This "Back" button can be using anytime in that page(to previous page), whether the fields are filled or not. But, whenever i clicked on this button, validation alerts is alarmed.

How do i make these 2 buttons coordinate? they have to be in the same form..

Help urgently needed.. Thx all

03-31-2003, 05:46 AM
Hi JaiL...

I don't understand why your validation scripts would be called when the "back" button is pressed.

The validation scripts should only be fired by the onSubmit event.
The "back" button should have it's own function.
It makes no sense that the "back" button would fire the onSubmit function (unless you wired it that way :eek: )

Maybe you need to show the code.

;) k

03-31-2003, 05:52 AM
Hi khaki,

this is a rough idea hows my codes are
<form name=form method=get value=servlet/abc onSubmit="return validation()">
//here are all the fields

<input type = button name = submit name = "Submit">
<input type = button name = back name = "Back">



is there anything wrong with this..?
im still a js newbie..
10x for advicing..

03-31-2003, 06:05 AM
okay JaiL...
here's the problem:

<input type = button name = submit name = "Submit">

should be this:
<input type="submit" value="Submit">

This will designate the submit button as... well... the submit button.
;) k

EDIT: Plus, I think that you are looking to "post" (not "get") and unless you have some kind of script that needs the "value" of the form, it's not required.