Welcome Guest, Not a member yet? Register   Sign In
set_value() is working but set_select() not working
#3

(09-07-2023, 08:11 AM)sammyskills Wrote: What exactly are you trying to achieve?

And why not show your controller code also?



Controller :


Code:
public function createDocument()
    {

        if ($this->request->getPost()) {
            $model = new DocumentsModel;
            $documents = new DocumentsEntity;

            $documents->no = $this->request->getPost('no');
            $documents->doc_type_id = $this->request->getPost('doc_type_id');
            $documents->expiry_date = $this->request->getPost('expiry_date');
            $documents->doc_file = $this->request->getFile('doc_file');

            if ($model->save($documents)) {

                return redirect()->back()
                    ->with('success', "Document added success")
                    ->withInput();
            } else {

                return redirect()->back()
                    ->with('warning', 'Please fix following errors!')
                    ->with('errors', $model->errors())
                    ->withInput();

                // return redirect()->back()
                //    ->with('success', "Document added success")
                //    ->withInput();
            }


        }

        $doc_types = new DocumentTypesModel;
        $doc_types = $doc_types->findAll();

        return view('employees/documents/create', [
            'doc_types' => $doc_types,
        ]);
    }


What im trying to achieve is, I have a form to add employee's supporting documents like ID Card, Passport etc... So in the form I have one select box and other input boxes. I need to keep the old entered value to the field if validaiton fails. So for that i use set_select() for select box and set_value() for input boxes.

set_value() is not working.
Reply


Messages In This Thread
RE: set_value() is working but set_select() not working - by sknair143 - 09-07-2023, 09:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB