Welcome Guest, Not a member yet? Register   Sign In
validation error messages not showing
#1

[eluser]macleodjb[/eluser]
Hi guys,

I'm having a small issue with showing validation or flash messages on my local wamp server. I have the statement for the validation_errors() in my view file and have everything i need in my controller. For some reason i just can't view the messages. If i want to check to make sure they are working i have to upload the controller and the view file to my remote server and test it, which it works fine there. So i am taking it as a configuration issue of some kind. I just don't know what needs to change. Any suggestions?
#2

[eluser]pistolPete[/eluser]
Post your code: validation, views, controller, config.
We can't help you without knowing anything!
#3

[eluser]macleodjb[/eluser]
there is no problem with the code. It works perfectly when i upload it. It just doesn't work locally. I think it's a session issue with my wamp configuration. I don't see how code can work on one server and not another.
#4

[eluser]TheFuzzy0ne[/eluser]
It still may help us figure out what might be different between the servers.
#5

[eluser]macleodjb[/eluser]
ok, here's some code

here's my controller
Code:
function add() {
        $this->load->model('Main_model');
        $this->load->library('form_validation');
        $bid_id = $this->uri->segment(3);

        if(!isset($_SESSION['uid'])){
            redirect('login/login');
        }
        if($this->Main_model->resume_exists($_SESSION['uid'])){
        redirect('edit/resume');
        }
        $this->load->library('fckeditor',array('instanceName' => 'resume_body'));
        
        $this->form_validation->set_rules('resume_body', 'resume_body', 'required|callback__check_resume');
        
        $data['page_title'] = "";
        $data['page_desc'] = "";
        $data['page_keywords'] = "";
        
        
        if ($this->form_validation->run() == FALSE){
            $this->load->view('resume/add_resume_form', $data);
        } else {
            if($this->add_resume($_SESSION['uid'])){
                $this->session->set_flashdata('message','Your resume was successfully uploaded');
                redirect('dashboard');
            } else {
                $this->session->set_flashdata('message','There was an internal error, please contact support');
                $this->load->view('resume/add_resume_form', $data);
            }            
        }
        
    }// end of function

and here is the view file
Code:
<?php
$this->load->model('Main_model');
$this->load->view("header_meta");
$this->load->view("header");
$this->load->view("hormenu");
include(base_url()."system/application/libraries/fckeditor.php");

?>
<tr><td>
&lt;?php
if(validation_errors()) {
echo "<div id=\"regerror\">". validation_errors() . "</div>";
}
if($this->session->flashdata('message')){
echo "<div id=\"regerror\">". $this->session->flashdata('message') . "</div>";
}
if(!empty($error)){
echo "<div id=\"regerror\">ERROR:". $error . "</div>";
}
?&gt;
<div id="text_element"></div>  

    <div id="module_box">
        &lt;form name="resumetxt" method="post" action=""&gt;
&lt;?php


$oFCKeditor = new FCKeditor('resume_body');
$oFCKeditor->BasePath = '/fckeditor/';
$oFCKeditor->ToolbarSet = 'Basic';
$oFCKeditor->Config['ToolbarCanCollapse'] = false;
$oFCKeditor->Height = '400';
$oFCKeditor->Width = '700';
$oFCKeditor->Create();
?&gt;
    </div>

        &lt;input type="submit" value="Upload Resume"&gt;
        
        &lt;/form&gt;
    </div>
</td></tr>
&lt;?php
$this->load->view("footer");
?&gt;
#6

[eluser]TheFuzzy0ne[/eluser]
And what messages can't you see? The errors? The flashdata?
#7

[eluser]macleodjb[/eluser]
locally i can't see the validation messages. I have to upload it to my server to see it work
#8

[eluser]TheFuzzy0ne[/eluser]
Is there any difference in the PHP versions? You might want to try setting error_reporting to E_ALL (if it's not already), and see if anything seems out of the ordinary. You might also want to try calling on $this->form_validation->error_string directly, to see if it actually stores anything.

Also, don't thing that this line:
Code:
include(base_url()."system/application/libraries/fckeditor.php");

will work as expected.

I would have thought something like:
Code:
include(APPPATH . 'libraries/fckeditor.php');

would be more effective, and much faster, too.

I'd also suggest that you look for any other include statements that use that format.




Theme © iAndrew 2016 - Forum software by © MyBB