Welcome Guest, Not a member yet? Register   Sign In
There is no data to update. error
#1

(This post was last modified: 02-11-2022, 12:50 PM by frocco.)

Hello, I am using summernote for the textarea field
Not sure what is causing this.

Code:
public function update()
    {
        $id = $this->request->getPost('id');

        $record = $this->getRecordOr404($id);
        $record->fill($this->request->getPost());

        if (!$record->hasChanged()) {

            return redirect()->back()
                ->with('warning', 'Nothing to update')
                ->withInput();
        }

        // Update slug incase title has changed
        $record->slug = url_title($record->title);
        if ($this->model->save($record)) {

            return redirect()->route('list_pages')
                ->with('info', 'Record updated successfully');
        } else {

            return redirect()->back()
                ->with('errors', $this->model->errors())
                ->with('warning', 'Invalid data')
                ->withInput();
        }
    }

Code:
namespace App\Entities;

use CodeIgniter\Entity\Entity;

class Page extends Entity
{
    protected $datamap = [];
    protected $dates  = ['created_at', 'updated_at', 'deleted_at'];
    protected $casts  = [];
    protected $attributes = ['title' => '', 'content' => ''];
}
Code:
namespace App\Models;

use CodeIgniter\Model;

class PageModel extends Model
{
    protected $DBGroup          = 'default';
    protected $table            = 'pages';
    protected $primaryKey      = 'id';
    protected $useAutoIncrement = true;
    protected $insertID        = 0;
    protected $returnType      = \App\Entities\Page::class;
    protected $useSoftDeletes  = false;
    protected $protectFields    = true;
    protected $allowedFields    = ['title', 'slug', 'content', 'zone', 'active'];

Code:
839         // Must be called first so we don't
840         // strip out updated_at values.
841         $data = $this->doProtectFields($data);
842
843         // doProtectFields() can further remove elements from
844         // $data so we need to check for empty dataset again
845         if (empty($data)) {
846             throw DataException::forEmptyDataset('update');
847         }
848
849         if ($this->useTimestamps && $this->updatedField && ! array_key_exists($this->updatedField, $data)) {
850             $data[$this->updatedField] = $this->setDate();
851         }
852
853         $eventData = [
Reply
#2

From what I can tell, it is a problem with the non bootstrap version of summernote and bulma.
I changed to TinyMCE and have no issues.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB