⚠ 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 is an archived forum. ⚠

  •     

profile picture

auto add a feild



Trần Đình Trọng
  • profile picture
  • Member

Posted 22 May 2013 - 08:41 AM

- I have a table, but i don't want to add a feild by crud , ex :

     id, name,catid(referent table categories)

- I don't want to use set relation with categories, i want to use catid by url parameter of function.

How to do this ?

thanks

 


davidoster
  • profile picture
  • Member

Posted 22 May 2013 - 09:30 AM

Usually wen we want to pass parameters within the url we use : $this->uri->segment(3)

Is this what you're asking?

 

Maybe you need also to have a look here.


Trần Đình Trọng
  • profile picture
  • Member

Posted 22 May 2013 - 09:58 AM

Usually wen we want to pass parameters within the url we use : $this->uri->segment(3)

Is this what you're asking?

Thanks, but it is not my problem.

a1d9cd79b631b9fa60d37cf62b7888f2_5578685

I don't want my user choose category from dropdown list or textbox (by set relation with categories)

 

May be like :

$crud->unset_fields('catid');

But when insert, the catid field must is inserted with value :

$this->uri->segment(3)

I am try use callback but not true :

$crud->callback_before_insert(array($this,'__add'));
function __add($post_array,$primary_key){
        $post_array['catid'] =$this->url->segment(3);
    }

Trần Đình Trọng
  • profile picture
  • Member

Posted 22 May 2013 - 10:26 AM

I have sloved my problem by custom crud model, thanks