2016-07-21 20 views
2

を使用してdd($ request)がTinyMCEのリクエストを取得できない原因はわかりませんがtinymceプラグインがあり、セレクタがtextareaです。私はテキストエディタである私のtextareaでリクエストを受け取ったかどうかチェックしようとしています。私がチェックすると、IDがcontentであるtextareaのカラムがありません。+request: ParameterBagLaravel 5.2

下のスクリーンショット

SC

はあなたがここに見ることができるようにそれは私のテキストエリアの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> 

私はここに私のテキストエリアの値を取得することができますが、それでも私は保存したり、自分のデータベースでこれを挿入することができますどのように任意のアイデアを持っていません。どんな助けでも大歓迎です。

フォーム:

<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', 
    ]); 
} 

} 

答えて

0

は、テキストエリアに名前を追加してください:

<div class = "form-group"> 
    <textarea id="content" name="content"></textarea> 
</div> 
+0

私はそれに気付きませんでした!あなたは速すぎます。ありがとう! – Francisunoxx