我正在嘗試使用 Dropdown 進行過濾,但它總是將最后一個值發送到鏈接選項

總是發送最后一個選項

過濾器控制器作業正常。我相信問題出在刀片的下拉選單中,它沒有發送鏈接選項
這是我的刀片
<form action="{{ action('App\Http\Controllers\HomePageController@processForm') }}" method="POST" class="woocommerce-ordering product-filter">
@csrf
<input type="hidden" value="alpha" name="sortoption"id="alpha">
<input type="hidden" value="desc" name="sortoption" id="desc">
<input type="hidden" value="asc" name="sortoption" id="asc">
<span class="orderby-label hide-desktop">Sort by</span>
<span te class="perpage-label">Sort by</span>
<select name="orderby" class="orderby filterSelect" aria-label="Shop order" data-class="select-filter-orderby">
<option for="alpha">Ordre Alphabetique</option>
<option for="desc">Prix Decroissant</option>
<option for="asc">Prix Croissant</option>
</select>
</form>
uj5u.com熱心網友回復:
你的語法<option>是錯誤的。for是<label>標簽中使用的屬性。設定選項值的屬性是value.
您也不需要隱藏輸入。
<form action="{{ action('App\Http\Controllers\HomePageController@processForm') }}" method="POST" class="woocommerce-ordering product-filter">
@csrf
<span class="orderby-label hide-desktop">Sort by</span>
<span class="perpage-label">Sort by</span>
<select name="sortoption" class="orderby filterSelect" aria-label="Shop order" data-class="select-filter-orderby">
<option value="alpha">Ordre Alphabetique</option>
<option value="desc">Prix Decroissant</option>
<option value="asc">Prix Croissant</option>
</select>
</form>
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/412344.html
標籤:
