• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Two Submit buttons on same page

AndyB

Well-known member
#1
Hello,

I would like to have two Submit buttons on the same page like this:

pic001.jpg

The template code is:

Code:
<xen:title>{xen:phrase trader_trader_admin}</xen:title>

<form action="{xen:link 'trader/adminseller'}" method="post" class="xenForm">
   
<dl class="ctrlUnit">
    <dt><label>{xen:phrase trader_view_sellers_history_for}:</label></dt>
    <dd><input type="text" name="seller_name" size="50" class="textCtrl AutoComplete AcSingle" /></dd>
</dl>   

<dl class="ctrlUnit submitUnit">
    <dt></dt>
    <dd><input type="submit" value="{xen:phrase trader_submit}" class="button primary" accesskey="s" /></dd>
</dl>

<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />

</form>

<br />

<form action="{xen:link 'trader/adminbuyer'}" method="post" class="xenForm">
   
<dl class="ctrlUnit">
    <dt><label>{xen:phrase trader_view_buyers_history_for}:</label></dt>
    <dd><input type="text" name="buyer_name" size="50" class="textCtrl AutoComplete AcSingle" /></dd>
</dl>   

<dl class="ctrlUnit submitUnit">
    <dt></dt>
    <dd><input type="submit" value="{xen:phrase trader_submit}" class="button primary" accesskey="s" /></dd>
</dl>

<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />

</form>
I'm currently experiencing the second form action is being selected even though I'm clicking the first Submit button.

Thank you.
 
Last edited:

AndyB

Well-known member
#3
Got it.

The trick is to have a unique value for the Submit.

Code:
<xen:title>{xen:phrase trader_trader_admin}</xen:title>

<form action="{xen:link 'trader/adminseller'}" method="post" class="xenForm">
	
<dl class="ctrlUnit">
    <dt><label>{xen:phrase trader_view_sellers_history_for}:</label></dt>
    <dd><input type="text" name="seller_name" size="50" class="textCtrl AutoComplete AcSingle" /></dd>
</dl>	

<dl class="ctrlUnit submitUnit">
    <dt></dt>
    <dd><input type="submit" value="{xen:phrase trader_submit_seller}" class="button primary" accesskey="s" /></dd>
</dl>

<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />

</form>

<br />

<form action="{xen:link 'trader/adminbuyer'}" method="post" class="xenForm">
	
<dl class="ctrlUnit">
    <dt><label>{xen:phrase trader_view_buyers_history_for}:</label></dt>
    <dd><input type="text" name="buyer_name" size="50" class="textCtrl AutoComplete AcSingle" /></dd>
</dl>	

<dl class="ctrlUnit submitUnit">
    <dt></dt>
    <dd><input type="submit" value="{xen:phrase trader_submit_buyer}" class="button primary" accesskey="s" /></dd>
</dl>

<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />

</form>