Validate with multiple submit buttons



I ran into a problem when preforming a validation in a form. The form
actually has two submit buttons. The first submit button automatically fills
in user information (called autofill), but the input type needs to be
"submit" The second submit button should be doing the validation. How can I
get around this?

Here is the script that does the validation:

function ValidateForm(){
var dt=document.frmSample.date1;
var dt1=document.frmSample.date2;
if (isDate(dt.value)==false) {
return false;
if (isDate(dt1.value)==false){
return false;
return true;

The first "submit" button should not validate:
<input type="submit" value="Autofill" name="obbtn_ks108">

This second submit button needs to do the validation:
<input type="submit" value="Submit" name="obbtn_yes">


Which button actually submits the completed form? The other should be a
simple button with an onclick event to run whatever has to be run. Only one
submit button is allowed for a form.


<input name="Button1" type="button" value="button" onclick="whatEver()" />

But then, why have two buttons? a single submit button can validate the
form and then submit it.
Ron Symonds
Microsoft MVP (Expression)

Reply only to group - emails will be deleted unread.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question