dpepbjp126917
dpepbjp126917
2015-08-16 13:06
浏览 110
已采纳

表单布局和按钮位置

This may be a silly question...

I have a table with a form which has a textarea in one row, on the row beneath is two cells, I want the 'submit' button which will send the input of this textarea on the right cell and a 'clear' button on the cell on the left which will post a different form if clicked. I know we can't have nested forms but is there a way to do this ?

Edited---------------

Here is the code from the table:

<tr>
<td colspan="5" align="left"><form name="confirm" id="confirm" action="order.php" method="post">
<span style="color:#cccccc;">Comments</span><br>
<textarea rows="3" cols="40" name="comments" id="comments"></textarea>
</td>
</tr>


<tr><td align="left" colspan="2">
<input type="hidden" name="tablenumber" value="none">
<input type="hidden" name="action" id="action" value="confirm">
<input type="submit" id="submit" value="CONFIRM" form="confirm" name="submit" class="confirm_btn"></form>
</td>

<td align="right" colspan="3">
<form name="clear" id="clear" action="menu4.php?catid=confirm_order" method="post">
<input type="hidden" name="tablenumber" value="none">

    <input type="hidden" name="action" id="action" value="clear">
    <input type="submit" id="submit" value="CLEAR" form="clear" name="submit" class="clear_btn"></form>&nbsp;
    </td></tr></table>

Yes, the clear button will be sending data, actually is will send a request to emptt the cart and refresh the page.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doutouhe5343
    doutouhe5343 2015-08-17 00:59
    已采纳

    I have worked it out. In HTML5 you can have form elements outside of the element and reference them using form="xxxx" (whatever the id is of the form).

    点赞 评论

相关推荐