• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP form_error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中form_error函数的典型用法代码示例。如果您正苦于以下问题:PHP form_error函数的具体用法?PHP form_error怎么用?PHP form_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了form_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: block_content

 public function block_content($context, array $blocks = array())
 {
     // line 4
     echo "<h4>Edit Kelas Aktif</h4>\n";
     // line 5
     echo get_flashdata("class");
     echo "\n\n";
     // line 7
     echo form_open("siswa/moved_class/" . (isset($context["status_id"]) ? $context["status_id"] : null) . "/" . (isset($context["siswa_id"]) ? $context["siswa_id"] : null), array("class" => "form-horizontal row-fluid"));
     echo "\n<table class=\"table table-striped\">\n    <tr>\n        <td>\n            <select class=\"span2\" name=\"kelas_id\">\n                <option value=\"\">--pilih--</option>\n                ";
     // line 13
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable(isset($context["kelas"]) ? $context["kelas"] : null);
     foreach ($context['_seq'] as $context["_key"] => $context["k"]) {
         // line 14
         echo "                    <option value=\"";
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "id"), "html", null, true);
         echo "\" ";
         echo $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "id") == $this->getAttribute(isset($context["get_aktif"]) ? $context["get_aktif"] : null, "kelas_id") ? "selected" : "";
         echo ">";
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "nama"), "html", null, true);
         echo "</option>\n                ";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['k'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 16
     echo "            </select>\n            <br>";
     // line 17
     echo form_error("kelas_id");
     echo "\n        </td>\n        <td>\n            <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n        </td>\n    </tr>\n</table>\n";
     // line 24
     echo form_close();
     echo "\n";
 }
开发者ID:Raniratna,项目名称:new_elearning,代码行数:35,代码来源:669a4f6e8c7dc02a4e11f673e2a6c35fc22a4b99b59d453296af0e9866a0.php


示例2: writeProjectRow

function writeProjectRow($idx, $project)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    if (is_numeric($project->lAssignedMin)) {
        $strValue = strDurationViaMinutes($project->lAssignedMin);
    } else {
        $strValue = $project->lAssignedMin;
    }
    echoT('
         <tr>
            <td class="enpViewLabel" style="padding-top: 8px;">' . htmlspecialchars($project->strGroupName) . ':
            </td>
            <td class="enpView" style="vertical-align: top;">
               <input type="text" name="txtPMin' . $idx . '"
                    size="5"
                    maxlength="8"  
                    style="text-align: right;"   onFocus="txtPMin' . $idx . '.style.background=\'#fff\';"
                    id="addEditEntry"
                    value="' . $strValue . '">
            </td>
            <td style="vertical-align: top; padding-top: 6pt;">
               hh:mm 
            </td>
            <td style="width: 45pt; text-align: right;vertical-align: top; padding-top: 6pt;">
               Notes:
            </td>
            <td style="text-align: top;">
               <textarea name="txtNotes' . $idx . '" rows="2" cols="30">' . $project->notes . '</textarea>' . form_error('txtPMin' . $idx) . '
            </td>
         </tr>');
}
开发者ID:simple-gifts,项目名称:Delightful-Labor,代码行数:33,代码来源:project_hours_view.php


示例3: process_form

 public function process_form()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules("name", "name", "required|trim|xss_clean");
     $this->form_validation->set_rules("comment", "comment", "xss_clean");
     // if validation errors exist, send user back to form else send user to result page.
     if ($this->form_validation->run() === FALSE) {
         $this->session->set_userdata('error', form_error('name'));
         redirect('/');
     } else {
         $this->session->unset_userdata('error');
         $this->session->set_userdata('name', $this->input->post('name', true));
         $this->session->set_userdata('location', $this->input->post('location'));
         $this->session->set_userdata('language', $this->input->post('language'));
         $this->session->set_userdata('comment', $this->input->post('comment', true));
         // set counter to display number of times current user submits the form
         if ($this->session->userdata('counter')) {
             $counter = $this->session->userdata('counter');
             $this->session->set_userdata('counter', $counter + 1);
         } else {
             $this->session->set_userdata('counter', 1);
         }
         redirect('result');
     }
 }
开发者ID:Jcareergoals,项目名称:CodeIgnitor_Survey_Form,代码行数:25,代码来源:surveys.php


示例4: validateSettings

 /**
  * Validate the settings form.
  */
 public function validateSettings(&$element, &$form_state)
 {
     $schema = drupal_get_schema('membership_entity');
     if ($element['length']['#value'] > $schema['fields']['member_id']['length']) {
         form_error($element['length'], t('Member ID length cannot exceed %max.', array('%max' => $schema['fields']['member_id']['length'])));
     }
 }
开发者ID:AndresDiaz1,项目名称:FLIP,代码行数:10,代码来源:MembershipEntityNumericMemberId.class.php


示例5: login_proses

 function login_proses()
 {
     $data['pesan'] = '';
     $data['username'] = $this->input->post('username');
     $data['password'] = $this->input->post('password');
     $this->form_validation->set_rules("username", 'Username', 'trim|required|xss_clean');
     $this->form_validation->set_rules("password", 'Password', 'trim|required|xss_clean');
     # message rules
     $this->form_validation->set_message('required', 'Field %s harus diisi.');
     if ($this->form_validation->run() == FALSE) {
         // jika tidak valid
         $data['pesan'] .= trim(form_error('username', ' ', ' ')) == '' ? '' : form_error('username', ' ', '<br>');
         $data['pesan'] .= trim(form_error('password', ' ', ' ')) == '' ? '' : form_error('password', ' ', '<br>');
         $this->load->view('auth/form_login', $data);
     } else {
         $result = $this->mdl_auth->ceklogin($data);
         if ($result->num_rows() > 0) {
             $this->session->set_userdata('user_id', $result->row()->user_id);
             $this->session->set_userdata('user_name', $result->row()->user_name);
             $this->session->set_userdata('full_name', $result->row()->full_name);
             $this->session->set_userdata('user_level_id', $result->row()->user_level_id);
             $this->session->set_userdata('kd_fakultas', $result->row()->kd_fakultas);
             $this->session->set_userdata('kd_prodi', $result->row()->kd_prodi);
             $this->session->set_userdata('login', TRUE);
             redirect('main');
         } else {
             $data['pesan'] .= '<b>Login Gagal<b> <br> masukan username dan password dengan benar.';
             $this->load->view('auth/form_login', $data);
         }
     }
 }
开发者ID:bosokpp1,项目名称:p-siakad,代码行数:31,代码来源:auth.php


示例6: submitform1

 function submitform1()
 {
     $this->form_validation->set_rules('input-txtfield', 'Textfield', 'trim|required|xss_clean|max_length[100]');
     $this->form_validation->set_rules('input-textarea', 'Textarea', 'trim|required|xss_clean|max_length[1024]');
     $this->form_validation->set_rules('input-radio', 'Radio', 'trim|required|xss_clean');
     $this->form_validation->set_rules('input-checkbox[]', 'Checkbox', 'trim');
     $successurl = base_url('welcome/form1');
     if ($this->form_validation->run() == false) {
         $res['error'] = true;
         $res['display_errors']['input-txtfield-error'] = form_error('input-txtfield');
         $res['display_errors']['input-textarea-error'] = form_error('input-textarea');
         $res['display_errors']['input-radio-error'] = form_error('input-radio');
         $res['display_errors']['input-checkbox-error'] = form_error('input-checkbox');
     } else {
         $res['error'] = false;
         $res['s_title'] = "STitle";
         $res['s_text'] = "Form submitted successfully";
         $res['eval_script'] = "load_view('#my-content', 'content1', '" . $successurl . "');";
     }
     if ($this->input->is_ajax_request()) {
         echo json_encode($res);
     } else {
         if ($res['error'] == true) {
             $this->res = $res;
             $this->view_maintenance_head($society_id, $head_id);
         } else {
             $this->session->set_flashdata('success_message', $res['s_text']);
             redirect($successurl);
         }
     }
 }
开发者ID:nirajdama,项目名称:ajaxify,代码行数:31,代码来源:welcome.php


示例7: signup

 /**
  * Signup
  * Presents user with a signup form.
  */
 public function signup()
 {
     $this->load->helper('form');
     $this->layouts->set_title('Sign Up');
     $data['signup_form_first_name'] = $this->security->xss_clean($this->input->post('signup_form_first_name'));
     $data['signup_form_last_name'] = $this->security->xss_clean($this->input->post('signup_form_last_name'));
     $data['signup_form_email'] = $this->security->xss_clean($this->input->post('signup_form_email'));
     $data['signup_form_username'] = $this->security->xss_clean($this->input->post('signup_form_username'));
     $data['signup_form_lost_password_question_1'] = $this->security->xss_clean($this->input->post('signup_form_lost_password_question_1'));
     $data['signup_form_lost_password_question_2'] = $this->security->xss_clean($this->input->post('signup_form_lost_password_question_2'));
     $data['signup_form_lost_password_question_3'] = $this->security->xss_clean($this->input->post('signup_form_lost_password_question_3'));
     if ($this->input->post('ajax') && !$this->input->post('test')) {
         $this->layouts->view('accounts/signup', $data, 'json');
     } elseif ($this->input->post('ajax') && $this->input->post('test')) {
         $data['changes'] = [];
         if (form_error($this->input->post('test_field'))) {
             $data['changes'][] = ['target' => '#' . $this->input->post('test_field') . '_error', 'content' => form_error($this->input->post('test_field'))];
         } else {
             $data['changes'][] = ['target' => '#' . $this->input->post('test_field') . '_error', 'content' => ''];
         }
         $data['changes'][] = ['target' => '#signup_form_bucket_csrf_token', 'value' => $this->security->get_csrf_hash()];
         $this->layouts->view(null, $data, 'json');
     } else {
         $this->layouts->view('accounts/signup', $data);
     }
 }
开发者ID:brianamarojeppesen,项目名称:buckethabit,代码行数:30,代码来源:Accounts.php


示例8: save

 public function save()
 {
     $this->load->library('form_validation');
     $frm = $this->form_validation;
     $frm->set_rules('name', 'Name', 'trim|required');
     $frm->set_rules('database', 'Database', 'trim|required');
     $frm->set_message('required', 'กรุณากรอก %s');
     if ($frm->run() == FALSE) {
         $message = '';
         $message .= form_error('name');
         $message .= form_error('database');
         $result = array('result' => FALSE, 'message' => $message);
     } else {
         $post = $this->input->post(NULL, TRUE);
         // returns all POST/GET items with XSS filter
         $data = array('id' => $post['id'], 'name' => $post['name'], 'database' => $post['database'], 'remark' => $post['remark']);
         $this->model->id = $post['id'];
         if ($this->model->save($data)) {
             $result = array('result' => true);
         } else {
             $result = array('result' => false, 'message' => $this->db->error());
         }
     }
     echo json_encode($result);
 }
开发者ID:sunzandesign,项目名称:PHP-Builder,代码行数:25,代码来源:Start.php


示例9: proses

 public function proses()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('username', 'Username', 'trim|required|alpha_numeric|min_length[3]');
     $this->form_validation->set_rules('password', 'Password', 'trim|required');
     if ($this->form_validation->run() == FALSE) {
         if (validation_errors('username') != NULL) {
             $view['error_username'] = strip_tags(form_error('username'));
         }
         if (validation_errors('password') != NULL) {
             $view['error_password'] = strip_tags(form_error('password'));
         }
     } else {
         $this->load->model('login_model');
         $username = $this->input->post('username');
         $password = $this->input->post('password');
         $doLogin = $this->login_model->doLogin($username, $password);
         if ($doLogin) {
             $this->load->library('sess');
             $this->sess->sess_reg($doLogin);
             $view['success'] = "Success Login";
         } else {
             $view['error_failed'] = "username or password WRONG!";
         }
     }
     header('content-type:application/json');
     echo json_encode($view);
     exit;
 }
开发者ID:philtyphil,项目名称:realisasi,代码行数:29,代码来源:login.php


示例10: _nuevoProveedor_Cliente

 function _nuevoProveedor_Cliente($tipo)
 {
     $nombre = $_POST["nombre"];
     $rif = $_POST["rif"];
     $msj_nombre = "";
     $msj_rif = "";
     $error = 0;
     $this->load->library("form_validation");
     $this->form_validation->set_rules("nombre", "Nombre", "required");
     $this->form_validation->set_rules("rif", "RIF", "required|is_rif");
     if ($this->form_validation->run()) {
         try {
             /*if($tipo=="Proveedor"){
                   $proveedorCliente=new Entities\Proveedor;
               }else{
                   $proveedorCliente=new Entities\Cliente;
               }*/
             $proveedorCliente = new Entities\ProveedorCliente();
             $proveedorCliente->setNombre($nombre);
             $rif = preg_replace("/^([J|V|G])\\-?(\\d{8})\\-?(\\d)\$/", "\$1-\$2-\$3", $rif);
             $proveedorCliente->setRif($rif);
             $proveedorCliente->setTipo($tipo);
             guardar($proveedorCliente, TRUE);
         } catch (Exception $e) {
             $error = 1;
             $nombre = "";
             $rif = "";
         }
     } else {
         $msj_nombre = form_error("nombre");
         $msj_rif = form_error("rif");
         $error = 1;
     }
     return json_encode(array("nombre" => $nombre, "rif" => $rif, "error" => $error, "msj_nombre" => $msj_nombre, "msj_rif" => $msj_rif));
 }
开发者ID:josercl,项目名称:forum,代码行数:35,代码来源:Ajax.php


示例11: index

 public function index()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('user_full_name', 'Name', 'required|min_length[5]');
     $this->form_validation->set_rules('user_name', 'username', 'required|min_length[5]|is_unique[users.username]');
     $this->form_validation->set_rules('email_address', 'Email', 'required|is_unique[users.email]|valid_email');
     $this->form_validation->set_rules('password', 'Password ', 'required|min_length[5]|matches[con_password]');
     $this->form_validation->set_rules('con_password', 'Password', 'required|min_length[5]');
     $this->form_validation->set_message('required', 'required');
     $this->form_validation->set_message('min_length', 'lenght');
     $this->form_validation->set_message('is_unique', 'Allready exist');
     $this->form_validation->set_message('valid_email', 'Invalid Email');
     $this->form_validation->set_message('matches', 'password not match');
     if ($this->form_validation->run() == true) {
         $this->user_model->add_user();
         $this->load->library('email');
         $this->email->from('[email protected]', 'Komail');
         $this->email->to($this->input->post('email_address'));
         $this->email->subject('Email Verification');
         $this->email->message('http://privilegedpk.com/prev/index.php/signup/verify?email=' . $this->input->post('email_address'));
         $this->email->send();
         //echo $this->email->print_debugger();
         redirect('main', 'refresh');
     } else {
         redirect($this->input->post('current') . 'un=' . form_error('user_name') . '&&nam=' . form_error('user_full_name') . '&&email=' . form_error('email_address') . '&&pass=' . form_error('password') . '&&pass1=' . form_error('con_password'));
     }
 }
开发者ID:rayedbajwa,项目名称:Privilege---Coupon-based-solution-for-codeigniter,代码行数:27,代码来源:signup.php


示例12: addsupport

 public function addsupport()
 {
     $this->form_validation->set_rules('fname', 'FirstName', 'trim|required|max_length[300]');
     $this->form_validation->set_rules('lname', 'LastName', 'trim|required|max_length[300]');
     $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
     $this->form_validation->set_rules('phone', 'Phone', 'trim|is_natural|min_length[10]|max_length[11]');
     $this->form_validation->set_rules('cmt', 'Address', 'trim|required|max_length[300]');
     $this->form_validation->set_rules('zip', 'Zipcode', 'trim|is_natural');
     $this->form_validation->set_rules('recaptcha', 'ReCaptcha', 'callback_check_recaptcha');
     if (!$this->form_validation->run()) {
         $result = array('ajax' => 1, 'error_fname' => form_error('fname'), 'error_lname' => form_error('lname'), 'error_email' => form_error('email'), 'error_phone' => form_error('phone'), 'error_cmt' => form_error('cmt'), 'error_zip' => form_error('zip'), 'error_recaptcha' => form_error('recaptcha'), 'capt' => $this->create_capt());
         echo json_encode($result);
     } else {
         $this->email->from('[email protected]', 'Email Support');
         $this->email->to($this->input->post('email'));
         $this->email->cc('[email protected]');
         $this->email->subject($this->input->post('fname') . ' Need to support!');
         $this->email->message('First Name: ' . $this->input->post('fname') . '<br>' . 'Last Name: ' . $this->input->post('lname') . '<br>' . 'Phone: ' . $this->input->post('phone') . '<br>' . 'Address: ' . $this->input->post('address') . '<br>' . 'City: ' . $this->input->post('city') . '<br>' . 'State/Province: ' . $this->input->post('s_p') . '<br>' . 'Zip/Postal Code: ' . $this->input->post('zip') . '<br>' . 'Industry: ' . $this->input->post('indus') . '<br>' . 'Message:<br>' . $this->input->post('cmt'));
         if ($this->email->send()) {
             $result['result'] = "\n\t\t\t\t<div class='alert alert-success' role='alert'>\n\t\t\t\t\t<strong>Well done!</strong>Thanks for your mail. We will contact you as soon as posible!<br>\n\t\t\t\t  \t<a href='" . base_url() . "' class='alert-link'>Back to Home Page!</a>\n\t\t\t\t</div>\n\t\t\t\t";
             $result['kt'] = 0;
             echo json_encode($result);
         } else {
             $result['result'] = "\n\t\t\t\t<div class='alert alert-warning' role='alert'>\n\t\t\t\t\t<strong>Warning!</strong>There are Errors! Please try againt!<br>\n\t\t\t\t  \t<a href='" . base_url() . "' class='alert-link'>Back to Home Page!</a>\n\t\t\t\t</div>\n\t\t\t\t";
             $result['kt'] = 1;
             echo json_encode($result);
         }
     }
 }
开发者ID:AnhThi,项目名称:Syslytic,代码行数:29,代码来源:Fro_support_ct.php


示例13: add_new_category

 function add_new_category()
 {
     // validate form
     $this->load->library('form_validation');
     $this->form_validation->set_rules('categoryName', 'categoryName', 'trim|required|xss_clean');
     // if form is invalid
     if ($this->form_validation->run() == FALSE) {
         if (form_error('categoryName')) {
             $this->session->set_flashdata('msg', 'กรุณาใส่ชื่อหมวดหมู่');
             redirect('admin/add_category');
             return;
         }
     }
     $name = set_value('categoryName');
     //add category
     $arr = array('category_name' => $name);
     $res = $this->Category->add_category($arr);
     // if can't add to db
     if ($res == FALSE) {
         $this->session->set_flashdata('msg', 'ไม่สามารถเพิ่มหมวดหมู่ได้');
         redirect('admin/add_category');
         return;
     }
     redirect('admin/category');
 }
开发者ID:M4A1Predator,项目名称:dealer_system,代码行数:25,代码来源:Category_set.php


示例14: block_content

 public function block_content($context, array $blocks = array())
 {
     // line 4
     echo "<div class=\"module\">\n    <div class=\"module-head\">\n        <h3>";
     // line 6
     echo isset($context["module_title"]) ? $context["module_title"] : null;
     echo "</h3>\n    </div>\n    <div class=\"module-body\">\n        ";
     // line 9
     echo get_flashdata("mapel");
     echo "\n\n        ";
     // line 11
     echo form_open("admin/mapel/add", array("class" => "form-horizontal row-fluid"));
     echo "\n            <div class=\"control-group\">\n                <label class=\"control-label\">Nama <span class=\"text-error\">*</span></label>\n                <div class=\"controls\">\n                    <input type=\"text\" name=\"nama\" class=\"span8\" value=\"";
     // line 15
     echo twig_escape_filter($this->env, set_value("nama"), "html", null, true);
     echo "\">\n                    <br>";
     // line 16
     echo form_error("nama");
     echo "\n                </div>\n            </div>\n            <div class=\"control-group\">\n                <label class=\"control-label\">Deskripsi</label>\n                <div class=\"controls\">\n                    <textarea name=\"info\" class=\"span12\" rows=\"5\">";
     // line 22
     echo set_value("info");
     echo "</textarea>\n                </div>\n            </div>\n            <div class=\"control-group\">\n                <div class=\"controls\">\n                    <button type=\"submit\" class=\"btn btn-primary\">Simpan</button>\n                    <a href=\"";
     // line 28
     echo twig_escape_filter($this->env, site_url("admin/mapel"), "html", null, true);
     echo "\" class=\"btn\">Batal</a>\n                </div>\n            </div>\n        ";
     // line 31
     echo form_close();
     echo "\n\n    </div>\n</div>\n";
 }
开发者ID:Raniratna,项目名称:new_elearning,代码行数:29,代码来源:e77bfcb44e01e83cd758d3bf076b694ee0546ba32e73d1a1f758f2d79475.php


示例15: block_content

 public function block_content($context, array $blocks = array())
 {
     // line 4
     echo "<div class=\"module\">\n    <div class=\"module-head\">\n        <h3>";
     // line 6
     echo isset($context["module_title"]) ? $context["module_title"] : null;
     echo "</h3>\n    </div>\n    <div class=\"module-body\">\n        ";
     // line 9
     echo get_flashdata("kelas");
     echo "\n\n        <div class=\"panel panel-default\">\n            <div class=\"panel-heading\">\n                Tambah Kelas\n            </div>\n            <div class=\"panel-body\">\n                ";
     // line 16
     echo form_open("admin/kelas", array("class" => "form-horizontal row-fluid"));
     echo "\n                    <div class=\"control-group\">\n                        <label class=\"control-label\">Nama Kelas <span class=\"text-error\">*</span></label>\n                        <div class=\"controls\">\n                            <input type=\"text\" name=\"nama\" class=\"span5\" placeholder=\"Nama Kelas\" value=\"";
     // line 20
     echo twig_escape_filter($this->env, set_value("nama"), "html", null, true);
     echo "\">\n                            <button type=\"submit\" class=\"btn btn-primary\">Simpan</button>\n                            ";
     // line 22
     echo form_error("nama");
     echo "\n                        </div>\n                    </div>\n                ";
     // line 25
     echo form_close();
     echo "\n            </div>\n        </div>\n\n        <p><b>Note:</b> Kelas tidak dapat di hapus namun dapat di ubah menjadi tidak aktif</p>\n\n        ";
     // line 31
     echo isset($context["kelas_hirarki"]) ? $context["kelas_hirarki"] : null;
     echo "\n\n        <br>\n        <div id=\"response_update\"></div>\n        <button class=\"btn btn-primary\" id=\"update-hirarki\">Update Hirarki</button>\n    </div>\n</div>\n";
 }
开发者ID:Raniratna,项目名称:new_elearning,代码行数:26,代码来源:e21e79c49e313b4c30919792b145d76ccb359710f0fc8fdd1add2842d09e.php


示例16: multi_career

 public function multi_career()
 {
     //comprobamos si es una petición ajax
     if ($this->input->is_ajax_request()) {
         $this->form_validation->set_rules('code', 'codigo', 'required');
         $this->form_validation->set_rules('name', 'nombre', 'required');
         $this->form_validation->set_message('required', 'El %s es obligatorio');
         if ($this->form_validation->run() == FALSE) {
             //de esta forma devolvemos los errores de formularios
             //con ajax desde codeigniter, aunque con php es lo mismo
             $errors = array('code' => form_error('code'), 'name' => form_error('name'), 'respuesta' => 'error');
             //y lo devolvemos así para parsearlo con JSON.parse
             echo json_encode($errors);
             return FALSE;
         } else {
             $code = $this->input->post('code');
             $name = $this->input->post('name');
             //si estamos editando
             if ($this->input->post('id')) {
                 $id = $this->input->post('id');
                 $this->career->edit_career($id, $code, $name);
                 //si estamos agregando una carrera
             } else {
                 $this->career->new_career($code, $name);
             }
             //en cualquier caso damos ok porque todo ha salido bien
             //habría que hacer la comprobación de la respuesta del modelo
             $response = array('respuesta' => 'ok');
             echo json_encode($response);
         }
     }
 }
开发者ID:AndrewJey,项目名称:Proyecto-1-web-rsa,代码行数:32,代码来源:career.php


示例17: reset_password

 public function reset_password()
 {
     $response['status'] = 'n';
     $username = $this->tank_auth->get_username();
     if ($this->input->post('password')) {
         $this->form_validation->set_rules('password', '密码', 'trim|required|xss_clean|min_length[' . $this->config->item('password_min_length', 'tank_auth') . ']|max_length[' . $this->config->item('password_max_length', 'tank_auth') . ']|alpha_dash');
         $this->form_validation->set_rules('confirm_password', '确认密码', 'trim|required|xss_clean|matches[password]');
         if ($this->form_validation->run()) {
             $forgotten_data = $this->tank_auth->forgot_password($username);
             if (!is_null($forgotten_data)) {
                 $reset_data = $this->tank_auth->reset_password($forgotten_data['user_id'], $forgotten_data['new_pass_key'], $this->form_validation->set_value('password'));
                 if (!is_null($reset_data)) {
                     $response['status'] = 'y';
                     $response['info'] = '密码修改成功';
                 }
             } else {
                 $errors = $this->tank_auth->get_error_message();
                 foreach ($errors as $k => $v) {
                     $response['info'][$k] = $this->lang->line($v);
                 }
             }
         } else {
             $response['info']['password'] = form_error('password');
             $response['info']['confirm_password'] = form_error('confirm_password');
         }
         echo json_encode($response);
     } else {
         $this->load->view('front/memeber_reset_password.php', $data);
     }
 }
开发者ID:zackwong,项目名称:book-sys,代码行数:30,代码来源:member.php


示例18: validateOptionsForm

 public function validateOptionsForm(&$form, FormStateInterface $form_state)
 {
     // Require a key if the format is key.
     if ($form_state['values']['options']['format'] == 'key' && $form_state['values']['options']['key'] == '') {
         form_error($form['key'], $form_state, t('You have to enter a key if you want to display a key of the data.'));
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:7,代码来源:Serialized.php


示例19: block_content

 public function block_content($context, array $blocks = array())
 {
     // line 4
     echo "<div class=\"btn-group pull-right\">\n    <a class=\"btn btn-primary btn-small\" href=\"";
     // line 5
     echo twig_escape_filter($this->env, site_url("tugas/tambah_soal/" . $this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "id")), "html", null, true);
     echo "\">Tambah Pertanyaan</a>\n    ";
     // line 6
     if ($this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "type_id") == 3) {
         // line 7
         echo "    <a class=\"btn btn-primary btn-small\" href=\"";
         echo twig_escape_filter($this->env, site_url("tugas/tambah_pilihan/" . $this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "id") . "/" . $this->getAttribute(isset($context["pertanyaan"]) ? $context["pertanyaan"] : null, "id")), "html", null, true);
         echo "\">Tambah Pilihan</a>\n    ";
     }
     // line 9
     echo "</div>\n\n<h4>Edit Pertanyaan ke ";
     // line 11
     echo twig_escape_filter($this->env, isset($context["no_pertanyaan"]) ? $context["no_pertanyaan"] : null, "html", null, true);
     echo "</h4>\n";
     // line 12
     echo get_flashdata("tugas");
     echo "\n\n";
     // line 14
     echo form_open("tugas/edit_soal/" . $this->getAttribute(isset($context["tugas"]) ? $context["tugas"] : null, "id") . "/" . $this->getAttribute(isset($context["pertanyaan"]) ? $context["pertanyaan"] : null, "id"));
     echo "\n<table class=\"table table-striped\" style=\"margin-top:20px;\">\n    <tbody>\n        <tr>\n            <td>\n                <textarea name=\"pertanyaan\" id=\"pertanyaan\" style=\"height:400px;width:100%;\">";
     // line 19
     echo set_value("pertanyaan", html_entity_decode($this->getAttribute(isset($context["pertanyaan"]) ? $context["pertanyaan"] : null, "pertanyaan")));
     echo "</textarea>\n                ";
     // line 20
     echo form_error("pertanyaan");
     echo "\n            </td>\n        <tr>\n        <tr>\n            <td colspan=\"2\">\n                <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n            </td>\n        </tr>\n    </tbody>\n</table>\n";
     // line 30
     echo form_close();
     echo "\n";
 }
开发者ID:Raniratna,项目名称:new_elearning,代码行数:35,代码来源:71d49f7a78df3c2ae25b319519e77a446f8d21fcf0672fd1a09ecb88bc5d.php


示例20: show_if_error

/**
 * Displays an error if the given class has an error attached to it
 */
function show_if_error($field_name)
{
    $error = form_error($field_name);
    if (!empty($error)) {
        return '<span class="help-block">' . $error . '</span>';
    }
}
开发者ID:andreamswick,项目名称:filter-twitter,代码行数:10,代码来源:form_validation_helper.php



注:本文中的form_error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP form_errors函数代码示例发布时间:2022-05-15
下一篇:
PHP form_end_tag函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap