Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've been trying to figure out how to shrink down the form fields of the Drupal 7 version of the Date module, but I have not been able to find anything that describes how to do it.
What I want to do is convert a date form field from something like this:
+-v The date field's title ----+
| +--------------------------+ |
| | Date | |
| | +------------+ | |
| | | 2010-01-12 | | |
| | +------------+ | |
| | Description | |
| +--------------------------+ |
+------------------------------+
to something like this:
The date field's title
+------------+
| 2010-01-12 |
+------------+
Description
Basically, removing the field set and the extra box between the field set and the text field, and replacing "Date" with the title of the field.
Where can I find information on how to do this?
Thank you.
Comment | File | Size | Author |
---|---|---|---|
#9 | date field.png | 9.94 KB | karimiehsan1819 |
Comments
Comment #1
joppert CreditAttribution: joppert commentedI've got the same question/issue
Hope someone can point us in ht eright direction
Comment #2
drupso CreditAttribution: drupso commentedAn alternative is with CSS using display:none in label Date and set border: none in first & second fieldset. It's possible other way (a theming date function with code) ???
Regards
Comment #3
chaiwei CreditAttribution: chaiwei commentedI end up create a simple module to overwrite it.
example below.
Comment #4
anrikun CreditAttribution: anrikun commentedTurning this into a feature request:
- the way date fields are themed does not respect the way other core fields are themed. Especially that fieldset that seems to annoy a lot of people here.
- date fields break W3C validation.
IMHO this really need some improvement.
I'm OK to submit patches.
Comment #5
KarenS CreditAttribution: KarenS commentedIs this now a duplicate of #1538072: Date field rendering does not conform to Drupal field standards -- or vice versa? Let's focus on specific issues and one topic per issue.
Comment #6
oadaeh CreditAttribution: oadaeh commentedI am all for having better theme override options for the date fields. However, that is not the issue I posted. I simply wanted to find out what was possible, and how to get where I wanted to go.
Thank you drupso for your suggestions.
Thank you chaiwei for your code sample.
With my own poking around, they both helped me reach my goal.
In addition to the hook_form_alter code, here is what I have in an included .css file:
As far as I am concerned, this issue is fixed.
anrikun, I recommend you start a new issue. If you need this issue as a reference, you can link to it.
Again, thank you all.
Comment #8
ranga143 CreditAttribution: ranga143 commentedthanks ..its working fine........
Comment #9
karimiehsan1819 CreditAttribution: karimiehsan1819 commentedhi , i want remove or hide border of date field , how can i do it?
Comment #10
oadaeh CreditAttribution: oadaeh as a volunteer commented@karimiehsan1819, based on your screen sot, that looks like just a normal text field, so you should be able to use CSS to remove the border.
Comment #11
parveroshan CreditAttribution: parveroshan commented#3 is worked for me.. thank you so much :) :)