0

I've got a Date field on my content type and I'm using the jQuery pop-up calendar as the widget. The html rendered for it has extra stuff that I'd like to strip away, but I can't find a way to configure what it looks like.

Here's my current Edit form:

enter image description here

Notice with all of the non-date fields, the name of the field is bold and directly above the textfield/select box, etc.

However, with the date field, the field name is not bold, then there is a space, then a bold "Date" and THEN the textbox which is linked to the popup calendar.

I would like it to end up like this:

enter image description here

I understand that I can try to just hack it by hiding things with css, but that's not what I'm looking for.

I'm looking to find a way to configure drupal to render this field the same way it renders all of the others, instead of rendering tags that just take up bandwidth and get hidden by css.

EDIT: This isn't an issue of a special configuration. I just installed vanilla drupal in a new directory. I installed the date module. I enabled the date module along with the date popup module (comes with it). I added a date field to the Article content type and set it's widget type to be popup calendar. Went to add a new Article node and it appeared just like I said above.

enter image description here

  • where does Birth Date come from? is it a Label that can be Hidden under Manage Display? – Geoff Aug 11 '14 at 1:06
  • "Birth Date" is the display name of the field on my content type. I don't want to hide "Birth Date" I want to keep that, but hide the extra, and unhelpful, "Date" that shows up below "Birth Date". Does that make sense? – Kenny Wyland Aug 11 '14 at 1:10
  • I can't seem to reproduce the effect - all I get is the label I assign. Is it perhaps in a field collection or something similar that has its own label? – Geoff Aug 11 '14 at 1:51
  • Geoff, I just installed vanilla drupal in a new directory. I installed the date module. I enabled the date module along with the date popup module (comes with it). I added a date field to the Article content type and set it's widget type to be popup calendar. Went to add a new Article node and it appeared just like I said above. I'm not sure why you aren't seeing it. – Kenny Wyland Aug 11 '14 at 4:44
  • 1
    It's wrapped in a fieldset @Kenny, the non-bold bit (Birth date) is the legend. One of these should help: drupal.stackexchange.com/questions/40546/…, drupal.stackexchange.com/questions/52255/…, drupal.stackexchange.com/questions/53173/… – Clive Aug 11 '14 at 9:06
0

So it turned out to be a two-fold issue. Thank you to Geoff and Clive who provided the larger part of the solution!

Step 1 - By default, the Date module renders a date field as a fieldset which is why the field name is differently styled and separated from the element a bit. The quick solution is to add a very short function to your template.php which tells the system to format a date field in the same way you'd format any other element. Like so:

function MYTHEME_date_combo($variables) {
  return theme('form_element', $variables);
}

I pulled that code from how to avoid fieldset in drupal date field

Step 2 - Edit the Content Type, Edit the date Field, expend "More settings and values", then expand "Advanced Settings", and change the Label position from "Above" to "None." That will get rid of the internal label.

enter image description here

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.