Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Callback Error Message Not Showing Where Should Be
#1

[eluser]riwakawd[/eluser]
I am having trouble with my call back error message it is not showing up where it should be.

It should be showing up above the first input. Were all call back go. But for some reason the call back goes on the same line as the form_error.

I need it all call backs to go where my if error message section is.

How do i fix my call back to get what I am after.

My View


Note: form action does not display on here.
Code:
<form acti echo base_url('install/step_3a');?>" method="post" enctype="multipart/form-data" class="form-horizontal">

<!-- Call Back Error Message -->
<div class="row">
&lt;?php if ($error_warning) { ?&gt;
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> &lt;?php echo $error_warning; ?&gt;
<button type="button" class="close" data-dismiss="alert">&times;</button>
</div>
&lt;?php } ?&gt;
</div>

<fieldset>

<div class="form-group required">
<label class="col-sm-2 control-label" for="input-username">&lt;?php echo $entry_username; ?&gt;</label>
<div class="col-sm-10">
&lt;?php echo form_input(array('name' => 'username', 'id' => 'username', 'class' => "form-control", 'value' => $username)); ?&gt;
&lt;?php echo form_error('username', '<div class="text-danger">', '</div>'); ?&gt;
</div>
</div>

<div class="form-group required">
<label class="col-sm-2 control-label" for="input-password">&lt;?php echo $entry_password; ?&gt;</label>
<div class="col-sm-10">
&lt;?php echo form_input(array('name' => 'password', 'id' => 'password', 'class' => "form-control", 'value' => set_value('password'))); ?&gt;
&lt;?php echo form_error('password', '<div class="text-danger">', '</div>'); ?&gt;
</div>
</div>

<div class="form-group required">
<label class="col-sm-2 control-label" for="input-email">&lt;?php echo $entry_email; ?&gt;</label>
<div class="col-sm-10">
&lt;?php echo form_input(array('name' => 'email', 'id' => 'email', 'class' => "form-control", 'value' => set_value('email'))); ?&gt;
&lt;?php echo form_error('email', '<div class="text-danger">', '</div>'); ?&gt;
</div>
</div>

</fieldset>

<div class="buttons">
<div class="pull-left">
<a href="&lt;?php echo $back; ?&gt;" class="btn btn-default">&lt;?php echo $button_back; ?&gt;</a>
</div>
<div class="pull-right">
&lt;input type="submit" value="&lt;?php echo $button_continue; ?&gt;" class="btn btn-primary" /&gt;
</div>
</div>

&lt;/form&gt;

My Controller

Code:
&lt;?php

class Step_3a extends CI_Controller {

private $error = array();

public function index() {

  $this->lang->load('install', 'english');

  $data['title'] = 'Configuration';
  
  if ($this->input->server('HTTPS')) {
   $data['base'] = HTTPS_SERVER;
  } else {
   $data['base'] = HTTP_SERVER;
  }

  $this->load->library('form_validation');

  $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|xss_clean|callback_validate');
  $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]');
  $this->form_validation->set_rules('email', 'Email', 'required|valid_email|xss_clean');

  if($this->form_validation->run() == true) {

   $this->load->model('model_install');

   $this->model_install->database($this->input->post());

   redirect(site_url('/'));

  } else {

   $data['entry_username'] = "Username";
   $data['entry_password'] = "Password";
   $data['entry_email'] = "Email";

   $data['button_continue'] = "Continue";
   $data['button_back'] = "Back";

   if (array_key_exists('warning', $this->error)) {
    $data['error_warning'] = $this->error['warning'];
   } else {
    $data['error_warning'] = '';
   }

   if (array_key_exists('username', $this->error)) {
    $data['error_username'] = $this->error['username'];
   } else {
    $data['error_username'] = '';
   }

   if (trim($this->input->post('username'))) {
    $data['username'] = $this->input->post('username');
   } else {
    $username = $data['username'] = 'admin';
   }

   $data['back'] = site_url('/');

   $data['header'] = $this->load->view('common/header', $data, true);
   $data['footer'] = $this->load->view('common/footer', null, true);

   $this->load->view('install/step_3a', $data);
  }
}

public function validate() {
  if($this->input->post('username')) {
   $this->error['username'] = $this->form_validation->set_message('validate', 'Please Enter Correct Username Or Password');
  }
  
  return !$this->error;
}
}


Messages In This Thread
[SOLVED] Callback Error Message Not Showing Where Should Be - by El Forum - 07-20-2014, 05:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB