2
我不知道哪個原因,但我有一個tinymce
插件,其選擇器是我的textarea
。我試圖檢查我的textarea
是文本編輯器上的請求。當我檢查它沒有爲我textarea
其中有content
下低於+request: ParameterBag
截圖一個ID的任何列。
正如你可以在這裏看到它沒有任何關鍵這是我的textarea的content
ID。任何人都可以告訴我如何解決這個問題。
腳本:
<script>
tinymce.init
({
selector: '#content',
plugins: [
'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker',
'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',
'save table contextmenu directionality emoticons template paste textcolor save'
], //The plugins configuration option allows you to enable functionality within the editor.
toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons | save',
save_enablewhendirty: true,
height: 400,
});
function get_editor_content()
{
// Get the HTML contents of the currently active editor
console.debug(tinymce.activeEditor.getContent());
// Get content of a specific editor:
var selectContent = tinymce.get('content').getContent();
}
</script>
我可以在這裏我textarea的價值,但仍然沒有任何想法,我怎麼可以保存或插入這個對我的數據庫。任何幫助將不勝感激。
形式:
<form class = "form-vertical" role = "form" method = "post" action = "{{ route('document.create')}}">
<div class = "form-group">
<label for = "title" class = "control-label">Title:</label>
<input type = "text" name = "title" class = "form-control">
</div>
<div class = "form-group">
<label for = "to" class = "control-label">To:</label>
<select onChange = "showUserOptions(this)" name = "to[]" multiple class = "form-control" id = "myUserList">
@foreach ($result as $list)
<option value = "{{ $list->id }}">{{ $list->username }}</option>
@endforeach
</select>
</div>
<div class = "form-group">
<label for = "category" class = "control-label">Category:</label>
<select onChange = "showCategoryOptions(this)" name = "category" class = "form-control" id = "myCategory">
<option selected disabled>Please select role</option>
@foreach ($resultCategory as $categoryList)
<option value = "{{ $categoryList->id }}">{{ $categoryList->category_type }}</option>
@endforeach
</select>
</div>
<div class = "form-group">
<textarea id="content"></textarea>
</div>
<div class = "form-group">
<button type = "submit" class = "btn btn-primary" onclick="get_editor_content()">Send</button>
</div>
<input type = "hidden" name = "_token" value = "{{ Session::token() }}">
</form>
控制器:
class DocumentController extends Controller
{
public function getDocuments()
{
$result = DB::table('users')->where('id', '!=', Auth::id())->get();
$resultCategory = DB::table('categories')->get();
return view ('document.create')->with('result', $result)->with('resultCategory', $resultCategory);
}
public function postDocuments(Request $request)
{
dd($request);
$this->validate($request,
[
'to' => 'required',
'title' => 'required|alpha_dash|max:255',
'category' => 'required',
'content' => 'required',
]);
}
}
我沒注意到!你太快了。感謝你! – Francisunoxx