Welcome Guest, Not a member yet? Register   Sign In
Weird form validation problem
#3

[eluser]iainco[/eluser]
Sorry, I've not been working on this problem for a while but just started.

The field names in the view are exactly the same as the field names I've setup for the validation.

Strange little problem but still can't get it fixed.

This is my updated code:

Code:
<tr>
                        <td><label for="email1">E-mail Address</label></td>
                        <td>
                            &lt;input id="email1" name="email1" type="text" class="fv['email']" value="&lt;?php echo set_value('email1');?&gt;" /&gt;
                            &lt;?php echo form_error('email1');?&gt;
                        </td>
                    </tr>
                    <tr>
                        <td><label for="email2">Confirm E-mail Address</label></td>
                        <td>
                            &lt;input id="email2" name="email2" type="text" class="fv['']" value="&lt;?php echo set_value('email2');?&gt;" /&gt;
                            &lt;?php echo form_error('email2');?&gt;
                        </td>
                    </tr>
                    <tr>
                        <td><label for="password1">Password</label></td>
                        <td>
                            &lt;input id="password1" name="password1" type="password" class="fv['password']" value="&lt;?php echo set_value('password1');?&gt;" /&gt;
                            &lt;?php echo form_error('password1');?&gt;
                        </td>
                    </tr>
                    <tr>
                        <td><label for="password2">Confirm Password</label></td>
                        <td>
                            &lt;input id="password2" name="password2" type="password" class="fv['']" value="&lt;?php echo set_value('password2');?&gt;" /&gt;
                            &lt;?php echo form_error('password2');?&gt;
                        </td>
                    </tr>

Code:
$this->form_validation->set_rules(array(
                        [removed]

            array(
                'field' => 'email1',
                'label' => 'E-mail Address',
                'rules' => 'trim|required|max_length[50]|valid_email|xss_clean'
            ),
            array(
                'field' => 'email2',        
                'label' => 'Confirm E-mail Address',                
                'rules' => 'matches[email1]|callback__emailCB'
            ),
            array(
                'field' => 'password1',    
                'label' => 'Password',            
                'rules' => 'min_length[6]|max_length[12]|xss_clean'
            ),
            array(
                'field' => 'password2',    
                'label' => 'Confirm Password',            
                'rules' => 'matches[password1]'
            ))
        );
        
                [removed]
        
        if ($this->form_validation->run()) {
                        $this->display('home');
        }
        else {
            $this->display('register');
        }

Any clues would be really helpful.

PS. I have not modified the "matches" error message with the set_message function.


Messages In This Thread
Weird form validation problem - by El Forum - 12-12-2008, 08:08 AM
Weird form validation problem - by El Forum - 12-13-2008, 12:39 AM
Weird form validation problem - by El Forum - 01-14-2009, 08:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB