⚠ 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

im stuck with callback_after_insert - need help



crackdcode

crackdcode
  • profile picture
  • Member

Posted 06 September 2015 - 09:25 AM

hello guys - my question is actually on set_relation, when i choose from the drop down it storing the id of the field instead of the actual text.is there a way to get the text instead of the id. thanks a lot.


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 07 September 2015 - 13:18 PM

well.. u can then not choose to use set relation.. rather u can set field type to be enum with having the set of texts as values 

http://www.grocerycrud.com/documentation/options_functions/field_type#enum-field - this will help u understand as how it gets done..

 

this way u will have a drop down without having the ID.

 

If you still need to have text along with ID .. then u can just directly have an additional field which is going to store text value.. set that field to be hidden .. and add callback after insert / update .. there u can select the actual row of relation table and populate the field with respective value..

 

There are multiple ways to a solution.. its upto you what suites u and what you will choose!!

 

 

Happy GCing ..


crackdcode

crackdcode
  • profile picture
  • Member

Posted 08 September 2015 - 01:02 AM

assalamualaikum Amit, thanks for the quick response.

 

is this possible?  $crud->field_type('fruits','set',arraycoming from a table??? ))

in the array part data will be coming from  a table.

 

thanks again.


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 08 September 2015 - 10:09 AM

well u can extract the data from the table for surre - coding is your creativity and all you coders are awsomely creative.. enjoy the same :)