⚠ 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

Relationship 1-n, how



inlinerider
  • profile picture
  • Member

Posted 27 June 2017 - 07:31 AM

How can I create a relationship with grocerycrud 1-n , as in the attached image

 

 

Sure that this is answered several times, but my English is not very good and I do not know how to look for it

 

Thanks for help
 
 

 


xheradon
  • profile picture
  • Member

Posted 27 June 2017 - 12:07 PM

Did you read the documentation or search for it? Despite your "not very good English" I'm sure you are able to search something like "1-n relation grocery crud" on Google.

 

https://www.grocerycrud.com/documentation/options_functions/set_relation


inlinerider
  • profile picture
  • Member

Posted 27 June 2017 - 18:35 PM

Hello xheradon, thanks for answering

 

I already look at the contents of the url  https://www.groceryc...ns/set_relation  and search for google, but I did not find what I am looking for.

 

I'm already using 'set_relation' for lists and 'set_relation_n_n' and they work fine.

 

But I do not know how to add records from the second table in the form

 

Please, you could show me a clear example how to make crud in this case, I am a beginner

 

I'm looking at how to do with grocerycrud something like this [attachment=1222:one-to-many-form.png]

 

-> Create a form that contains a subform (a one-to-many form)

 

 

 

Thank you for help

 

 

 
 

nose, a lo mejor simplemente lo estoy enfocando mal


inlinerider
  • profile picture
  • Member

Posted 28 June 2017 - 07:39 AM

Apparently Grocery CRUD does not support the option to join a new table

 

I put the links I found, I have to check them

 

 

 

 

 

 

Forums are no longer what they were :(


xheradon
  • profile picture
  • Member

Posted 28 June 2017 - 13:01 PM

So... I don't know if grocery crud supports that, but you can add extra fields on add form and using callback_before_insert method to manipulate data and insert it on different tables.