⚠ 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

use set_relation with field_type set?



ceroberoz
  • profile picture
  • Member

Posted 18 February 2014 - 08:28 AM

when I use

$crud->set_relation('a','table_b','b');

with

$crud->field_type('a','set');

 

the dropdown box is missing and it become a normal text field with no select w/ set function.

 

any how to?


Amit Shah
  • profile picture
  • Member

Posted 19 February 2014 - 05:20 AM

first question - why u need a set relation if u plan to use a set ... ?

Again when u changing the field type to set - that relation will anyways get nullified. Also the way u have used set is incomplete

Refer to - http://www.grocerycrud.com/documentation/options_functions/field_type#set-field

 

Here u will see u missing the array (U need to provide array for the values of the set) !!

 

Happy GCing :)


ceroberoz
  • profile picture
  • Member

Posted 24 February 2014 - 23:34 PM

first question - why u need a set relation if u plan to use a set ... ?

Again when u changing the field type to set - that relation will anyways get nullified. Also the way u have used set is incomplete

Refer to - http://www.grocerycrud.com/documentation/options_functions/field_type#set-field

 

Here u will see u missing the array (U need to provide array for the values of the set) !!

 

Happy GCing :)

...because I need the dropdown values from the other table.. and select a few values from it? . _ .

my current solution is to use set_relation_n_n, but if you has any other Ideas I will try it.


Amit Shah
  • profile picture
  • Member

Posted 25 February 2014 - 12:48 PM

well - if u plan to provide a filter in the set relation you can do it with ease if u can set where clause ... like

$crud->set_relation('a','table_b','b', array('field1'=>'some value')); 

- this way u can set the where clause in the criteria itself and filter the data.

 

Set_relation_n_n is different from set_relation. Now its upto you as how you want to use the same and get solution :)