0

I need to hide a radio button field of a content type (not a form) only on the edit view based either on its own value or based on the value of another field that is already hidden.

Dependencies does not work, I think because the other field is already hidden and because it does not allow the dependent and dependee field to be the same field.

Any ideas?

0

You can give a try to this module: https://www.drupal.org/project/ffc

  • Nice tip, i will find this module useful, however it did not resolve this issue as it hid the field on view content but not on edit content. i need the opposite. – srm Oct 26 '15 at 21:03
  • Did you try this: drupal.org/project/conditional_fields – chefnelone Oct 27 '15 at 7:46
-1

You may want to try hook_form_alter on that particular form. For example i had a case where i wanted a field to only show if it had more than one taxonomy term

    function members_form_members_node_form_alter(&$form, &$form_state,$form_id){
if(count($form['field_church_']['und']['#options']) > 1){
 $form['field_church_']['und']['#required'] = TRUE;} 
     else{
    unset($form['field_church_']);}
return $form;}
  • Thanks, just a bit over my head. i can adapt the code, just not sure where to put it. In a new module? – srm Oct 26 '15 at 21:05
  • You should use the #access property instead of unsetting $form elements. – mpdonadio Oct 26 '15 at 21:55
  • You are right. In my case i didn't want people to see the field. – mooru Oct 27 '15 at 21:28
  • Don't know why this answer is downvoted as it seems like the reasonable thing to do. I'm looking for a solution to this myself, but my case is a bit more complicated: I want to conditionally show a field based on another field, but these 2 fields are in a paragraph, which are referenced by a field in another paragraph which are referenced by a field in a content type. If anyone has any ideas, I'm all ears. – Bogdan Sep 27 '16 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.