protected function _saveTestimoni() { $record = array(); $record['nama'] = $this->post['nama']; $record['no_telepon'] = $this->post['no_telepon']; $record['email'] = $this->post['email']; $record['isi'] = $this->post['isi']; $rules = array(array('field' => 'nama', 'label' => 'Nama', 'rules' => 'required'), array('field' => 'no_telepon', 'label' => 'No. Telephone', 'rules' => 'phone'), array('field' => 'email', 'label' => 'Email', 'rules' => 'email'), array('field' => 'isi', 'label' => 'Testimonials', 'rules' => 'required')); $validation = new FormValidation($rules); if ($validation->run() == FALSE) { $this->SetFlash('row_testimoni', $record); $this->SetFlash('err_msg', $validation->GetError()); URL::Redirect(); } $this->setLogRecord($record, $id); $record['is_approve'] = 0; $return = $this->model_testimoni->Insert($record); if ($return) { $this->SetFlash('suc_msg', "Terima kasih {$record['nama']} atas testimoni yang Anda berikan."); } else { $this->SetFlash('row_testimoni', $record); $this->SetFlash('err_msg', "Maaf {$record['nama']}, testimoni Anda gagal disimpan."); } URL::Redirect(); }
function IsValid($record) { $rules = array(array('field' => 'nama', 'label' => 'Nama', 'rules' => 'required'), array('field' => 'tgl_pinjam', 'label' => 'Tgl. Pinjam', 'rules' => 'required'), array('field' => 'tgl_kembali', 'label' => 'Tgl. Kembali', 'rules' => 'required'), array('field' => 'jaminan', 'label' => 'Jaminan', 'rules' => 'required'), array('field' => 'kode_jaminan', 'label' => 'Kode Jaminan', 'rules' => 'required')); $validation = new FormValidation($rules); if ($validation->run() == FALSE) { $this->data['err_msg'] = $validation->GetError(); } if ($this->data['err_msg']) { $this->data['row'] = $record; $this->View($this->viewdetail); exit; } }
function IsValid($record) { $rules = array(array('field' => 'judul', 'label' => 'Judul', 'rules' => 'required'), array('field' => 'isi', 'label' => 'Isi', 'rules' => 'required')); $validation = new FormValidation($rules); if ($validation->run() == FALSE) { $this->data['err_msg'] = $validation->GetError(); } if ($this->data['err_msg']) { $this->data['row'] = $record; $this->View($this->viewdetail); exit; } }
function IsValid($record) { $rules = array(array('field' => 'id_member', 'label' => 'ID Member', 'rules' => 'required'), array('field' => 'nama', 'label' => 'Nama', 'rules' => 'required'), array('field' => 'tgl_lahir', 'label' => 'Tgl Lahir', 'rules' => 'required'), array('field' => 'anggota_sejak', 'label' => 'Anggota Sejak', 'rules' => 'required'), array('field' => 'tgl_registrasi', 'label' => 'Tgl Registrasi', 'rules' => 'required'), array('field' => 'berlaku_sampai', 'label' => 'Berlaku Sampai', 'rules' => 'required'), array('field' => 'jenis_kelamin', 'label' => 'Jenis Kelamin', 'rules' => 'required'), array('field' => 'alamat', 'label' => 'Alamat', 'rules' => 'required'), array('field' => 'kode_pos', 'label' => 'Kode Pos', 'rules' => 'required'), array('field' => 'alamat_surat', 'label' => 'Alamat Surat', 'rules' => 'required'), array('field' => 'no_hp', 'label' => 'No Hp', 'rules' => 'phone'), array('field' => 'no_identitas', 'label' => 'No. Identitas', 'rules' => 'required'), array('field' => 'no_identitas', 'label' => 'No. Identitas', 'rules' => 'number'), array('field' => 'catatan', 'label' => 'Catatan', 'rules' => 'required'), array('field' => 'email', 'label' => 'Email', 'rules' => 'email'), array('field' => 'password', 'label' => 'Password', 'rules' => 'required')); $validation = new FormValidation($rules); if ($validation->run() == FALSE) { $this->data['err_msg'] = $validation->GetError(); } if ($this->data['err_msg']) { $this->data['row'] = $record; $this->View($this->viewdetail); exit; } }
function isValid($record) { $rules = array(array('field' => 'nm_pasien', 'label' => 'Nama', 'rules' => 'required'), array('field' => 'alm_pasien', 'label' => 'Alamat', 'rules' => 'required'), array('field' => 'telp_pasien', 'label' => 'No. Telp.', 'rules' => 'required'), array('field' => 'komentar', 'label' => 'Kritik dan Saran', 'rules' => 'required'), array('field' => 'telp_pasien', 'label' => 'No. Telp.', 'rules' => 'phone')); $validation = new FormValidation($rules); $error_msg = ''; if ($validation->run() == FALSE) { $error_msg .= $validation->GetError(); } if ($error_msg) { $this->SetFlash('row_komentar', $record); $this->SetFlash('err_msg', $error_msg); URL::Redirect('#kritiksaran'); exit; } }
function IsValid($record) { $rules = array(array('field' => 'nama', 'label' => 'Nama', 'rules' => 'required'), array('field' => 'jk', 'label' => 'Jenis Kelamin', 'rules' => 'required'), array('field' => 'tgl_lahir', 'label' => 'Tgl. Lahir', 'rules' => 'required'), array('field' => 'telp', 'label' => 'Telepon', 'rules' => 'required'), array('field' => 'alamat', 'label' => 'Alamat', 'rules' => 'required'), array('field' => 'username', 'label' => 'Username', 'rules' => 'required')); $validation = new FormValidation($rules); if ($validation->run() == FALSE) { $this->data['err_msg'] = $validation->GetError(); } if ($this->post['password'] != $this->post['confirmpassword']) { $this->data['err_msg'] .= "Konfirmasi password salah"; } if ($this->data['err_msg']) { $this->data['row'] = $record; $this->View($this->viewdetail); exit; } }
function _isValidProfile() { $rules = array(array('field' => 'username', 'label' => 'Username', 'rules' => 'required'), array('field' => 'name', 'label' => 'name Lengkap', 'rules' => 'required')); if ($isnew == "true") { $rules[] = array('field' => 'password', 'label' => 'Password', 'rules' => 'required'); } $validation = new FormValidation($rules); $error_msg = ''; if ($validation->run() == FALSE) { $error_msg .= $validation->GetError(); } if ($this->post['password'] != $this->post['confirmpassword']) { if ($error_msg) { $error_msg .= "<br/>"; } $error_msg .= "Konfirmasi password salah"; } if ($error_msg) { $this->data['row'] = $this->post; $this->SetFlash('err_msg', $error_msg); return false; } return true; }
protected function IsValid($record) { $rules = $this->Rules(); $validation = new FormValidation($rules); if ($validation->run() == FALSE) { $this->data['err_msg'] = $validation->GetError(); } if ($this->data['err_msg']) { $this->data['row'] = $record; $this->View($this->viewdetail); exit; } }