form_fields

aksaks
edited April 2015 in Modules
function list_items($limit = NULL, $offset = NULL, $col = 'name', $order = 'asc', $just_count = FALSE)
{
$this->db->join('table1', 'table1.email = table.email', 'left')
->join('table2','table2.email=table.email','left');
$this->db->select('*', FALSE);
$data = parent::list_items($limit, $offset, $col, $order, $just_count);
return $data;
}


function form_fields($values = array(), $related = array())
{
$fields = parent::form_fields($values, $related);

// ******************* ADD CUSTOM FORM STUFF HERE *******************
// $fields['content']['img_folder'] = 'images/articles/';
//$fields['image']['folder'] = 'images/articles/';
//$fields['thumb_image']['folder'] = 'images/articles/thumbs/';

return $fields;
}

now i want to show data->content in different tables in form_fields according to my design but i didn't understand how to do .
i want to add some html here so please provide me good solution.

Comments

  • edited 7:19AM
    If you need a field the displays some sort of custom HTML, there is a custom field type. However, it's possible that one of the existing field types may do the trick for you. I'd recommend reviewing and playing out with some of the different field types found here:
    http://docs.getfuelcms.com/general/forms
  • aksaks
    edited 7:19AM
    thanks ,

    function form_fields($values = array(), $related = array())
    {
    $fields = parent::form_fields($values, $related);
    $this->db->join('examdata', 'appuser.email = examdata.email', 'left')
    ->join('certdata','certdata.email=examdata.email','left')
    ->where('email','abc@gmail.com');
    $this->db->select('*', FALSE);
    $data = parent::list_items($limit, $offset, $col, $order, $just_count);

    $this->load->library('form_builder');

    $this->form_builder->load_custom_fields(APPPATH.'config/custom_fields.php');

    $fields['passion']=$data->passion;

    return $fields;
    }

    actually i want to show passion value in the $fields['passion'].
  • edited 7:19AM
    Try the following:
    $fields['passion'] = array('type' => 'custom', 'value' => $data->passion);
  • aksaks
    edited 7:19AM
    thanks sir
    it's working perfectly
  • aksaks
    edited April 2015
    now i want to customized my form fields in different tables but i tried using php
    < pre>
    echo "< table>"."< caption>user data< /caption>"."< tr>"."< td>".$fields['name']=$data[$i]['name'];."< /td>"."< /tr>".
    ."< tr>"."< td>".$fields['email']=$data[$i]['email'];."< /td>"."< /tr>".
    ."< tr>"."< td>".$fields['age']=$data[$i]['age'];."< /td>"."< /tr>".
    ."< tr>"."< td>".$fields['gender']=$data[$i]['gender'];."< /td>"."< /tr>"."";
    < /pre>
  • edited 7:19AM
    There is a "template" field type you may want to try using which allows you to use a view file and will pass a $fields and $values array to it:
    http://docs.getfuelcms.com/general/forms#template
Sign In or Register to comment.