Support » Plugin: PDF Forms Filler for Contact Form 7 » How format date of birth?

  • Resolved delapartelilly

    (@delapartelilly)


    Hi,
    I need the DOB entered by the user printed in a formatted way in the pdf.
    The [_format_date-of-birth “m d y”] shortcode works for the data posted in the mail but I cannot make it work in the form so it gets filled in the pdf form in a formated manner.
    Appreciating any help.
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author maximum.software

    (@maximumsoftware)

    Whatever you get in the email is what you should get in the PDF. I am not sure why you are getting something different. What is your CF7 form code?

    Hi, thanks for answering.
    My CF7 form code is [date date-of-birth] which has as value a date in this format YYYY-MM-DD, however the format I need in the pdf file is MM-DD-YYY as it is in English. How can I change the format so it displays correctly when mapped to the pdf?
    Thanks in advance.

    Plugin Author maximum.software

    (@maximumsoftware)

    I believe the only way to do it is to write a filter for CF7. Something like the following,
    https://stackoverflow.com/questions/40000543/modify-contact-form-7-submission-data

    
    function action_wpcf7_posted_data_fix_dob( $array ) { 
        $value = $array['date-of-birth'];
        if( !empty( $value ) ){
            $parsed_date = // parse $array['date-of-birth'] here
            $array['date-of-birth'] = // date(".....", $parsed_date)
        }
    
        return $array;
    }; 
    add_filter( 'wpcf7_posted_data', 'action_wpcf7_posted_data_fix_dob', 10, 1 );
    

    However, this would change the value in your email message as well. Maybe this is not something you want.

    I can’t think of any good solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How format date of birth?’ is closed to new replies.