I want to display a checkbox when the user clicks upload documents in message template. How should i do it?
1 Answer
You'll need to create an extension - see https://docs.civicrm.org/dev/en/latest/extensions/ to get started, and then you'll want to look at https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/ to add the checkbox and then https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postProcess/ to actually do something with it when the form is saved.
But also because the upload documents section is in a hidden section until you click the radio, if you want to add the checkbox in the same section you'll also need to look at https://docs.civicrm.org/dev/en/latest/framework/region/#region-reference to put it in the right place, or maybe insert some javascript there that also hides/shows your checkbox when the radio is clicked.
-
-
my code is still not working. if i update my answer could you help me to resolve it?– safronJun 10, 2020 at 20:09
-
If there's a specific problem then maybe, but usually back-and-forth detailed help works best if you go chat.civicrm.org and ask in the
dev
oruser-support
channel. Also stackexchange is terrible about update notifications.– DemeritJun 10, 2020 at 20:12 -
ok thanks. i want to know can we call the civicrm_buildForm() function in different names on a same file ?– safronJun 10, 2020 at 20:21
-
1thank you! you really helped me to understand the concept behind this. Thank you very much!– safronJun 10, 2020 at 20:48