Skip to content

Validation Always Print Error Message #1903

Description

@rmcdahal

Here is my Controller
public function pagecreate() { $validation = $this->validate([ 'title' => 'required', 'content' => 'required' ]); if (!$validation) { $data['page_heading'] = 'Create New Page'; $data['content_view'] = 'Backend/Pages/Create'; echo view('Backend/Themes/Base', $data); } else { $this->model->save( [ 'title' => $this->request->getvar('title'), 'content' => $this->request->getVar('body') ] ); return redirect()->to(''); } }

Here is my Views
<div class="row"> <div class="col-md-12"> <div class="card-box"> <h4 class="m-t-0 header-title"><?php echo $page_heading; ?></h4> <?= service('validation')->listErrors() ?> <?php echo form_open('admin/pages/create'); ?> <div class="form-row">

And issue is Views always print validation error message ,
The title field is required.
The body field is required.
Is there any problems with my code ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions