Can we have more than one submit type button in one form?

Do I need to check for a form, but with two submit buttons?

Can we change the “Type” from jQuery so that it can work just fine as I want :)

+3
source share
2 answers

If you're talking about client-side checking, you can use JavaScript to send different messages to different locations (these locations may differ from checking it in more than one way on the server side), for example.

<form name="someForm1" id="someForm1" method="POST">
.
.
.


<input type="button" name="button1" id="button1" onclick="javascript:post1();"/>
<input type="button" name="button2" id="button2" onclick="javascript:post2();"/>
</form>

post1 (validate1()) post2 ( validate2()) . JavaScript URL-. , , :

function post1()
{
  var form1=document.forms['someForm1'];
  form1.action="form1.aspx";
  if(validate1())
  {
     form1.submit();
  }
  else
  {
     invalid1();
  }    
}
+1

All Articles