I have a "Select" field options for one of the custom data set. One of the "select" option is "Other". But I would like user to manually enter data related to "Other" field into another text field. Is it something possible to do?
2 Answers
The way to achieve this natively in CiviCRM without writing any code is to create a second text field in which the user can enter their "other" value.
If you want to further improve the UX you can write a little jQuery which will hide the extra field unless the "other" option is selected.
-
Voting you up as you're right - one doesn't necessarily need to hide/show - that would be a quick solution for @Tapash to get the field in without any coding. May 26, 2016 at 12:50
This is very possible and easy to configure with webform_civicrm module - for those of you on Drupal! The Drupal webform module has built-in conditionals. You can use it to show/hide any Contact field (core or custom) at any time depending on the value of any field (drupal, core or custom) selected by the user earlier on.
If you're not on Drupal - then you will need to code your own conditionals functionality:
-create the Other Text/TextArea field and insert it in the profile
-add some .js to pages that shows a profile with such fields in it
-use jQuery to hide the Other Text/TextArea field by default
-and to make it show when the Other option is clicked
EDIT: re: registering multiple participants: here is an example!
-have 4 Child-Contacts in the CiviCRM tab
-ask the user for the #Children they would like to register for the Event (webform field)
-use webform conditionals to show the correct # of Child-Contacts
-of course these fields can even be made to prefill for logged in users!
-but I can't show you that - or you'd know way to much about my kids!
-use the Event Registration section in the CiviCRM tab to create Event
-Registrations for all!
-(and perhaps mom/dad) - when form is submitted
-
In webform_civicrm I was going to suggest using the select_or_other module in conjunction with a CiviCRM text field (switching the widget in the webform to select-or-other).– ColemanMay 26, 2016 at 12:44
-
And the other would then get stored back into a CiviCRM custom field of your choice [not just live in Drupal]? I never even done that (yet)! May 26, 2016 at 12:46
-
Only problem with webform is, I cant allow multiple participants registration!!! or am I missing something?– TapashMay 26, 2016 at 12:50
-
-
@KarinG Yes, in CiviCRM it would just be a text field, but on the webform you could make it appear as select-or-other. It would store the option selected (or the other value) from the webform.– ColemanMay 26, 2016 at 12:51