簡體   English   中英

Select2-單擊提交按鈕后,選擇字段中沒有選定的值

[英]Select2 - There is no selected value in the selection field after clicking the submit button

我的選擇有問題。 當我選擇選項並單擊提交按鈕時,所選值將丟失。

  {{ Form::open(['url' => route('index'), 'method' => 'GET', 'class' => 'form']) }} {{ csrf_field() }} <select class="form-control select2" data-tags="true" data-placeholder="Select filter" data-allow-clear="true" name="filterClients" id="filterClientBy" style="width: 100%;"> <option></option> <option name="firstCalling" value="firstCalling" {{Request::has('firstCalling')?'selected':''}}>First callin</option> <option name="firstVisit" value="firstVisit"{{Request::has('firstVisit')?'selected':''}}>First visit</option> </select> <button type="submit" id="apply" class="btn btn-success">Apply filters</button> {{ Form::close() }} 
該代碼只是我的代碼的一部分...提交后沒有任何值。 怎么解決呢? 在此處輸入圖片說明 `

代替<form>使用<form action="name of file or #" method="post or get ">

表單submit是一種頁面刷新。 嘗試使用ajax請求submit表單

<form onsubmit="yourFunctionName()"> 
// rest of the form
</form>

function yourFunctionName(e){
    event.preventDefault();
    //here ajax code to submit the form value
  }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM