ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Codeigniter and Jeditable

July 26, 2011 5:46pm

Subscribe [1]
  • #1 / Jul 26, 2011 5:46pm

    chewbacca

    3 posts

    Hi everyone, this is my first post so I’m starting not to with issues.

    I’d rather leave here a simple way to use the class to Form_validation with jeditable.

    Actually very simple, we extended the run function in the Form_validation class, the following entry.

    // Function call
    284: function run($group = '', $jeditable = FALSE)
    334:  
    // Fix for JEDITABLE
    if($jeditable)
    {
     $this->_field_data[$field]['postdata'] = $this->_reduce_array($_POST['value'], $row['keys']);
    }
    else
    {
    $this->_field_data[$field]['postdata'] = $this->_reduce_array($_POST, $row['keys']);  
    }                                }


    Now even a change in the controller.

    // $this->validated_field are the Post Variables from jeditable
    $arr_as_str = $this->validated_field['id']. '[' .$this->validated_field['value']. ']'; 
    
    // is a example
    $validation_rules_str = 'xss_clean|trim|required|min_length[3]|max_length[20]'; 
    
    // setting rules
     $this->form_validation->set_rules($arr_as_str, $fieldname, $validation_rules_str); 
    
    // Second parameter is True,  otherwise is not run… :blush:
     if ($this->form_validation->run($this, TRUE) == FALSE)

    That was it ..., I hope you enjoy ...😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases