Welcome Guest, Not a member yet? Register   Sign In
validation not working after editing
#1

[eluser]Brain Coder[/eluser]
hey guys

i have some issues with my validation here

Controller :
Code:
function edit($id = 0){
      
      $data['title'] = "Edit Server";
      $data['main'] = 'admin_server_edit';
      $data['value'] = $this->MServers->getServer($id);
     if (!count($data['value'])){
     redirect('admin/servers/index','refresh');
        }
      $this->load->vars($data);
      $this->load->view('admin/dashboard');
  }

        function edit_do($id){
     $this->load->library('form_validation');        

     if($this->form_validation->run() != FALSE){
     $this->MServers->updateServer();
          $this->session->set_flashdata('message','Server Updated');
          redirect('admin/servers/index','refresh');
     }else{
     $this->form_validation->set_rules('plan_name','Plan Name',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_processor','Plan Processor',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_ram','RAM',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_hd','Hard Disk',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_connection','Connection',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_traffic','Traffic',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_system','System',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_cpanel','Control Panel',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_ip','IP',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_firewall','FireWall',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_nomange','No Manage',"trim|required|xss_clean");
     $this->form_validation->set_rules('plan_normal','With Manage',"trim|required|xss_clean");
     $this->form_validation->set_error_delimiters('<div class="Error">', '</div>');
     $data['title'] = "Edit Server";
     $data['main'] = 'admin_server_edit';
     $data['value'] = $this->MServers->getServer($id);
     $this->load->vars($data);
      $this->load->view('admin/dashboard');
     }
  }

View :
Code:
&lt;?php
$attributes = array('name' => 'server-form', 'id' => 'server-form');
echo form_open_multipart('admin/servers/edit_do/'.$value['plan_id'],$attributes);
?&gt;
<div id='page'>


<table border="0" width="100%" dir="ltr" cellspacing="0" cellpadding="0" align="center" class="cat_table">
<tr>
<td colspan="2" width="100%" class="main_td1">Plan Name</td>
</tr>
<tr>
<td width="50%" class="main_td2">Plan Name</td>
<td width="50%" class="main_td2">
&lt;?php $data = array('name'=>'plan_name','id'=>'plan_name','size'=>50,'value'=>$value['plan_name']);
echo form_input($data);?&gt;
&lt;?php form_error('plan_name') ?&gt;
</td>
</tr>
</table>

the problem is like that

if i want to edit Plan name (example) and left the input field EMPTY

it will redirect me to the view file again but without showing the error msg

like required.

in insert function its work , but with this one not working

can i have any help please Smile


Messages In This Thread
validation not working after editing - by El Forum - 04-14-2010, 06:58 PM
validation not working after editing - by El Forum - 04-14-2010, 11:17 PM
validation not working after editing - by El Forum - 04-15-2010, 06:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB