Adding additional parameter to form submit
Appending query string parameters onto the form action, and trying to change that at runtime is tricky (but not impossible). Far easier is to use hidden fields:
<form method="post" action="/Lot/LotList" id="filterForm">
<input type="hidden" name="auctionEventId" value="@auctionEventId" />
...
So now all you have to do is add another hidden field for "showAll"
<form method="post" action="/Lot/LotList" id="filterForm">
<input type="hidden" name="auctionEventId" value="@auctionEventId" />
<input type="hidden" name="showAll" value="false" id="showAllField" />
...
And just hook up a jquery event on your showAll button:
<input id="showAllButton" type="button"/>
jQuery:
$('#showAllButton').click(function(){
$('#showAllField').val("true");
$('#filterForm').submit();
});
I know you said this is not the issue but you can add attributes to Html.BeginForm
like this:
@using (Html.BeginForm("ActionName","ControllerName", FormMethod.Post, new { id = "filterform" })){
how about putting a hidden input
<form method="post" action="/Lot/LotList?auctionEventId=@auctionEventId" id="filterForm">
<input type="hidden" id="showAll" name="showAll" value=""/>
on your button
<input type="button" onclick="submitForm()" value="Show all" />
on your script somewhere
function submitForm(){
$('#showAll').val('true');
$('#filterForm').submit();
}