So i have an Table called 'FAQ' in here I have (question, answer, folder_id). for the question and answer i want to use CKeditor5. i can see the CKeditor clearly and the fonts etc are useable. but when i want to post the data to my controller I get this message back:
even though i filled these fields in, any idea how to resolve this error?
Create.blade
<form method="post" action="{{ route('admin.faq.store') }}" enctype="multipart/form-data">
@csrf
<div name="question">
<label for="question">{{('question')}}</label>
<div id="editorClassic" >
<input type="text" >
</div>
</div>
<br />
<div>
<label for="answer">{{('answer')}}</label>
<div id="editor">
<input type="text" name="answer" />
</div>
</div>
<br />
<div >
<label for="folder_id">{{('folder')}}</label>
<select name="faqsfolder_id">
@foreach($faqsfolder as $faqsfolder)
<option value="{{$faqsfolder->id}}">{{$faqsfolder->name}}</option>
@endforeach
</select>
</div>
<button type="submit" >Add FAQ</button>
</form>
store function (not finished i know)
public function store(Request $request)
{
$request->validate([
'question' => 'required',
'answer' => 'required',
'faqsfolder_id' => [
'required', 'exists:folder,id'
],
]);
CodePudding user response:
You are missing a name
attribute for your input <input type="text" >
If you change it into <input type="text" name="question">
then your variable should be sent to the server :D