0

Is it possible to change the label on a field using the conditional fields module. What I want is to call a field "Effective Date" in one case and "Published Date" in another but have it be the same field.

is that possible with the conditional fields module or any other module?

1

I answered this similar D7 question How to change a fields label name based on another fields value?

(function ($) {

   (function Forever(){ // we create a function called Forever

   var grabselectedtext = $('#edit-field-test-und option:checked').text();
   // this grabs the text of the field you want to depend on.

     $('label').each(function(){
      if ($(this).attr('for') == 'edit-body-und-0-value') {

         if (grabselectedtext != '- None -') {
           $(this).text(grabselectedtext);
         } else {
             $(this).text('Field Two');
           }
         }   

     });   

   setTimeout(Forever, 1);

   })();

})(jQuery);

You want to attach this JS code to a library. Then attach the library via a hook_form_alter and check for form ID and content type.

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