⚠ In case you've missed it we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠

how to add field of db in add form with some default value

how to add field

  • Please log in to reply
1 reply to this topic

#1 Vishal Kulshrestha

Vishal Kulshrestha


  • Members
  • Pip
  • 1 posts

Posted 09 April 2016 - 09:06 AM

$crud = $this->generate_crud('courses');
            $crud->set_relation('admin_id', 'admin_users', 'username');
            $this->mTitle = 'Courses';
In ,set_relation('admin_id', 'admin_users', 'username');
I want to display default value instead the value of tables.... 


#2 buoncri



  • Members
  • PipPip
  • 20 posts

Posted 12 April 2016 - 07:22 AM

I think you have to insert a callback and manually generate the field with all you need (html too).

        # callback in the main function
        $crud->callback_add_field('n_prop_spesa', array($this, '_aggiungi_documento'));

Then ... (end part of the callback function)

        # crea la stringa di ritorno con il valore del campo numero proposta di spesa  compilato
        $stringa_di_ritorno = '<input type="text" maxlength="50" value="' . strval(++$row["numeretto"]) . '" name="n_prop_spesa" style="width:462px">' . "\n";

        //return a string like ... '<input type="text" maxlength="50" value="1111" name="n_prop_spesa" style="width:462px">';
        return ($stringa_di_ritorno);

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users