My understanding is that you want clicking on either button to submit the form, but hitting enter to submit using the second button.
Here are a couple options:
1) Change how buttons are displayed
You can move the first button to actually be second in the markup, but change how it is displayed by positioning it differently. Note that you should also update the tabIndex if you do this.
.firstButton {
position: absolute;
width: 80px;
}
.secondButton {
position: absolute;
left: 90px;
width: 80px;
}
<form name="theForm" method="post" action="">
<input type="text" tabIndex='1' name="inp">
<div>
<input type="submit" tabIndex='2' class='secondButton' name="second" value="second">
<input type="submit" tabIndex='1' class='firstButton' name="first" value="first">
</div>
</form>
2) Change the first button not be a submit button and manually handle click
function submitForm() {
document.theForm.submit();
}
<form name="theForm" method="post" action="">
<input type="text" name="inp">
<input type="button" name="first" value="first" onclick="submitForm()">
<input type="submit" name="second" value="second">
</form>
Hope that helps.