Welcome Guest, Not a member yet? Register   Sign In
Validation Issue in IE7
#1

[eluser]Daniel P[/eluser]
I am having a small problem with the Validation library not displaying the validation errors when validating a form I am working on.
The validation works correctly when used in firefox and the validation error messages appear consistently.

However in Internet Explorer 7 the validation errors appear only some of the time, e.g. I will fail the validation the error messages will appear, I will resubmit the form and while the validation fails and returns to the form the error message will not appear. If I wait about a minute and then resubmit the form the error messages will appear.

Does anyone know what might cause this problem?
#2

[eluser]Paul Scott[/eluser]
Not without seeing your code or at least a hint to the structure of what you're doing?
#3

[eluser]Derek Allard[/eluser]
Since CI is server side, it isn't really possible that it would be generating code that wouldn't work only in IE, but that does help to narrow things down. Is it possible that the errors are in a span that isn't closed, or something similar? Is the page live so we can see the resulting pages?

Since I don't believe this to be a bug, I'm going to move it into a different forum to try to get more eyeballs on it for you.

Welcome to CodeIgniter Daniel!
#4

[eluser]Daniel P[/eluser]
Thanks for the quick reply guys. Unfortunately it is an internal website so you can't see it. I haven't been able to find any unclosed tags in my code.
Also it does work in Internet Explorer sometimes but not consistently, i.e. trying to resubmit the form after validation failure.

Here is the code in the controller
Code:
$this->validation->set_error_delimiters('<div class="error">', '</div>');
        
    $rules['username']    = "required";
    $rules['position']    = "required";
    $rules['startdate']    = "required";
    $rules['location']    = "required";        
    $this->validation->set_rules($rules);
    
    $fields['username']    = 'Username';
    $fields['position']    = 'Position';
    $fields['startdate']    = 'Start Date';
    $fields['location']    = 'Location';
    //$fields['team']    = 'Team';
    $this->validation->set_fields($fields);
            
        if ($this->validation->run())
        {
            $this->submit();    
        }
        else
        {
          $this->load->view('request/add',$data);
            
        }

Then in the view I am loading the errors like this
Code:
&lt;?php $this->load->view('header');?&gt;
&lt;?php $this->load->view('topbuttons');?&gt;

<div  id="fground">
&lt;?=$this->validation->error_string; ?&gt;
<h1>Add a Request</h1>

<br/>
<div class="form_outline">

The doctype I am using is
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I am a real beginner and can't really see what would cause internet explorer to behave like this. Any help would be appreciated.
#5

[eluser]Paul Scott[/eluser]
Are there any differences between the source of the HTML document when it works and doesn't work in IE?
If so, can you post the two versions?

Also, what is the entire controller method code? Perhaps there is something else in that function causing the problem?
#6

[eluser]Daniel P[/eluser]
I ran a text compare between the source of the working page and the not working page and the only difference was that the <div id="error>Error Message</div> tags appeared in the working file and not in the other one. I've posted the whole method below. I have tried putting the load->library('validation') statement and the helper in the constructor of the controller as well but with the same results.

Code:
function add()
    {
      $this->load->library('validation');        
      $query =$this->db->get('application');
      $data['applications']=$query->result();
      $query =$this->db->get('team');
      $data['teams']=$query->result();
      $this->db->where('visibleonform', 1);
      $query =$this->db->get('sgroup');
      $data['groups']=$query->result();
      $this->db->where('isuser', 1);
      $query =$this->db->get('requester');
      $data['requesters'] = $query->result();
      $this->load->helper('request');
      
        
        $this->validation->set_error_delimiters('<div class="error">', '</div>');
        
        $rules['username']    = "required";
        $rules['position']    = "required";
        $rules['startdate']    = "required";
        $rules['location']    = "required";        
    $this->validation->set_rules($rules);
    
    $fields['username']    = 'Username';
    $fields['position']    = 'Position';
    $fields['startdate']    = 'Start Date';
    $fields['location']    = 'Location';
    //$fields['team']    = 'Team';
    $this->validation->set_fields($fields);
            
        if ($this->validation->run())
        {
            $this->submit();    
        }
        else
        {
          $this->load->view('request/add',$data);
            
        }
      
    
    }
#7

[eluser]dfau[/eluser]
Try turning caching off. See header() for more info.
#8

[eluser]Daniel P[/eluser]
I finally worked out the issue Smile
It was to do with my Apache install and the mod_auth_sspi module I have loaded.

I needed to add SSPIPerRequestAuth On to my configuration of the module
see here for more details. http://trac.edgewall.org/ticket/4560

Thanks to everyone for the help in ruling out any other problems.
#9

[eluser]taewoo[/eluser]
Hi Daniel
I am also having this problem.
Can you post a more detailed explanation of your solution?

PS: PHP header cacheing disabling doesn't seem to help




Theme © iAndrew 2016 - Forum software by © MyBB