• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
add/edit validation with an Object

#6
[eluser]alpar[/eluser]
Code:
$rules['displayName']         = "required";
            $rules['eventLocation']     = "required";
            $rules['desc']                 = "required";
            $rules['email']             = "required|valid_email";
            $rules['startDate']         = "required";
            $rules['endDate']            = "required";        
            
            $this->validation->set_rules($rules);        
            
            $fields['displayName']         = 'Host Name';
            $fields['eventLocation']     = 'Event Location';
            $fields['desc']             = 'Event Description';
            $fields['email']             = 'Email Address';
            $fields['startDate']        = 'Start Date';
            $fields['endDate']            = 'End Date';

            $this->validation->set_fields($fields);
          
            if (empty($_POST))
            {
               // load some defaults
               $this->validation->displayName = $data['eventObj']->...;
            }

and you use just $this->validation->displayName in the view, you dont have to pass $data to it


Messages In This Thread
add/edit validation with an Object - by El Forum - 09-30-2007, 04:37 PM
add/edit validation with an Object - by El Forum - 10-01-2007, 07:59 AM
add/edit validation with an Object - by El Forum - 10-01-2007, 01:38 PM
add/edit validation with an Object - by El Forum - 10-01-2007, 01:45 PM
add/edit validation with an Object - by El Forum - 10-01-2007, 03:11 PM
add/edit validation with an Object - by El Forum - 10-02-2007, 12:32 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.