• I understand that the date placeholder needs to be in the format “yyyy-mm-dd” or use terms like “today”, but I need to use a custom text string instead. The rest of my complex form uses only placeholders and no labels, which significantly compacts the form and makes it look cleaner.
    Being forced to use a label instead of simply using “Date of Birth” as placeholder for the date field breaks the form layout, pushing fields out of alignment and completely wrecks the aesthetics.
    Yes, I can just use the date field w/o label, but it isn’t perfectly obvious that this field is meant for Date of Birth rather than something else, such as the date the form was filled out and/or signed.

    I tried a trick that somehow worked for this guy in 2021, but I can’t get it to work: video: date field placeholder trick

    In that short video, he does it like this:
    [date date-614 placeholder “Schedule:  “] as his shortcode, then he adds this CSS rule:

    .wpcf7 input[type="date"]:before {
    content: attr(placeholder);
    }

    And just like that, “Schedule: ” shows up on his date field to the left of “mm/dd/yyyy” as soon as he enters the new rule, and the date picker functions normally.

    I also tried using watermark instead of placeholder, no joy.
    Has anyone else gotten this trick to work? Did it really work at one time and a CF7 update has made this impossible now?

Viewing 1 replies (of 1 total)
  • Thread Starter IT Hertz

    (@it-hertz)

    I changed the form to include labels, since I’m now allowing user drafts and thus prefilling the form on later loads when the user returns to complete at a later time.

    As the form in question has lots of fields, not having labels could potentially cause confusion as to what various field data was for if the user forgets between uses, and forcing field deletion in order to see the placeholders only harms UI/UX.

    I’d still like to know for future reference whether anyone got the above trick to work.

Viewing 1 replies (of 1 total)
  • The topic ‘date field custom placeholder?’ is closed to new replies.