Issue
i'm trying to do a filter using Dropdown but it's always sending the last value to the link option
always sending the last option
the filter controller work fine. i believe the problem is in the dropdown menu in blade it doesn't send the option the link
this is my blade
<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>
Solution
Your syntax for <option>
is wrong. for
is an attribute used in <label>
tags. The attribute to set an option's value is value
.
You do not need the hidden inputs either.
<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>
Answered By - IGP
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.