jeudi 27 juin 2019

Ckeditor5 fails to automatically update the value of the element in Laravel

When I try to insert a new record into my database I get the following error I am using ckeditor5 to add some basic functionality to the textarea. I am using the classic build and according to the documentation, the plugin is meant to automatically update the textarea to what ever was typed when the form is submitted. However laravel gives me this error.

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'long_description' cannot be null (SQL: insert into jobs (date_closing, title, user_id, short_description, long_description, location, category_id, updated_at, created_at) values (1986-03-03, Sunt ipsam eum in au, 6, Nam qui duis soluta, , Perspiciatis laboru, 5, 2019-06-27 13:13:26, 2019-06-27 13:13:26))

my view with some fields removed for clarity

@extends('home')
@section('dashboardContent')
<script src="https://cdn.ckeditor.com/ckeditor5/12.2.0/classic/ckeditor.js"></script>
<h1>New Job:</h1>
<div class="row">
  <div class="col">
    <form action="" method="POST">
      @csrf
      <div class="form-group">
        <label for="jobDescription">Description</label>
        <textarea class="form-control" name="jobDescription" id="jobDescription" rows="6"></textarea>
      </div>
      <button type="submit" class="btn btn-primary">Save</button>
    </form>
  </div>
</div>

<script>
  ClassicEditor
      .create( document.querySelector( '#jobDescription' ) )
      .catch( error => {
          console.error( error );
      } );
</script>
@endsection

The textarea gets replaced successfully but I cannot figure out why when the form is submitted the text area content is still null/empty



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire