PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

GF did not pass the value to the date field formatted custom fields.

  1. enclave
    Member

    Hi there,

    I realized that my support ticket isn't submitted. So, I re-posted this.

    We're using Gravity Forms to create a post and we integrated this with the GF + Custom Post Type plugin. Basically, the problem we are having is that the value input by the user is not passed to the custom fields correctly. We have tried to output in a different field and it displayed correctly, just the Date field as in the screencast - http://screencast.com/t/voBmetVbm

    We know that it's a third party addon, however, we have contact the developer directly and he mentioned that the problem isn't because by his plugin and suggest us to contact you.

    Reason being is that it is related to the custom fields which is already available by Gravity Forms.

    Before that, we have contact the developer on the forum and recorded a screencast (above):
    http://wordpress.org/support/topic/date-format-value-did-not-passed-to-the-custom-field-created?replies=1

    Posted 6 years ago on Monday January 14, 2013 | Permalink
  2. Very good troubleshooting video: thank you.

    I would take a look at the value of the date stored in the entry, in the database. What format is that in?

    Also, you did not show the meta key name and meta key value in the wp_postmeta table. Can you show that as well? I suspect the date is being stored in one format in the post, but the WPCF meta field needs it in another format. Using the merge tag as you have in the form, with the default value, is fine, and shows that it's working, but I would be curious to see how the data is stored in the entry, and how the data is stored in the meta field, and to be certain the custom field name is exactly identical.

    Posted 6 years ago on Monday January 14, 2013 | Permalink
  3. enclave
    Member

    Hi there,

    Thank you for your prompt assistance and note of the Jing :) I'm glad that it helped the troubleshooting process.

    List of post ID involved (the others): 1701, 1717
    Metakey: wpcf-etimeline-start-date

    I'm not very technical when dealing with database, but I manage to pull this from the phpMySQL for the site. I notice it is showing a weird number.
    Screenshot 1 (DB Search Result): http://screencast.com/t/d34ZktvDH2vP
    Screenshot 2 (Row edit): http://screencast.com/t/Fd0T9PYS1r

    SQL file download link: http://eziclick.in/fddwpmetasql

    Posted 6 years ago on Tuesday January 15, 2013 | Permalink
  4. OK, you can see that the two posts, 1701 and 1717, have the date stored in a different format than the WPCF plugin is looking for. You're going to need to convert that before it's stored in the custom field, or update that existing meta value. There are a couple ways to do it. You can use the gform_pre_submission_filter to read the date that was submitted in your form, then convert that to the format WPCF needs, and store that in a hidden field. Then, using gform_after_submission, you can update the custom field which was just created with this new value.

    http://www.gravityhelp.com/documentation/page/Gform_pre_submission_filter
    http://www.gravityhelp.com/documentation/page/Gform_after_submission

    Or, you can possibly convert that date format using a filter in WPCF, but I am not familiar enough with that plugin to know what hooks are available.

    You could also set up a MySQL trigger to update the value, but that would be my last choice.

    The issue though is the date is formatted as a unix timestamp when it's stored by Gravity Forms, and the WPCF plugin needs to see it as MM/DD/YYYY

    Posted 6 years ago on Tuesday January 15, 2013 | Permalink
  5. enclave
    Member

    Hi Chris,

    Thank you for helping me out with this one. As much as I want to do this myself, I'm not sure how to approach the gform_pre_submission_filter and gform_after_submission.

    Do I just put the action and filter lines on functions.php?
    add_filter("gform_pre_submission_filter", "pre_submission_filter");
    add_action("gform_after_submission", "after_submission", 10, 2);

    And this would make it work? I think I'm wrong because it didn't specify to change the UNIX date format to MM/DD/YY or even better if we can have it set as what the default date format set in General Settings (WP Dashboard)

    Posted 6 years ago on Tuesday January 15, 2013 | Permalink
  6. I will take a look at this for you in about 12 hours. Thanks for your patience.

    Posted 6 years ago on Tuesday January 15, 2013 | Permalink
  7. enclave
    Member

    Sure. Thank you.

    Keep me posted.

    Posted 6 years ago on Tuesday January 15, 2013 | Permalink
  8. I just did some tests with this, and the date is stored as MM/DD/YYYY when I fill in a date field, when I pre-fill a field with the {date_mdy} merge tag, or when I use the {date_mdy} merge tag to populate a custom field. I was hoping to see what you see so I could help you convert the date, but I am not experiencing the conversion to unix timestamp as you are.

    Can you export your form as XML and email it to me at chris@rocketgenius.com please? I will install it as is and see if the date is stored in a different format when using your form.

    Posted 6 years ago on Tuesday January 15, 2013 | Permalink
  9. enclave
    Member

    Hi Chris,

    I have sent an email to you with the title: "Date format UNIX GF + CPT"

    I hope that helps.

    Posted 6 years ago on Wednesday January 16, 2013 | Permalink
  10. I took a look at your form. When I submit the form, the date is stored just as you have configured it in the form builder: MM/DD/YYYY. It is stored in the Gravity Forms wp_rg_lead_detail table that way and in the wp_postmeta table that way. It is displayed in the entry in that format. I don't think there is anything in Gravity Forms or WordPress changing the date format, although in your installation, with the WPCF plugin, the date is clearly stored in a different format.

    In this screenshot of yours http://screencast.com/t/Fd0T9PYS1r (this is the wp_postmeta table record) you can see that it is a Unix timestamp being stored. The 1356998400 which is stored there is Tue, 01 Jan 2013 00:00:00 GMT. Can you compare that to the date which was stored in the corresponding Gravity Form entry?

    It's possible that your WPCF plugin or something else is modifying that datestamp before storing it. Can you find out from that plugin developer if that is the case? If not, it could be another plugin on your site, but it would have to be something that gets in between Gravity Forms capturing the data and writing that wp_postmeta.

    Please let us know what you find out.

    Posted 6 years ago on Thursday January 17, 2013 | Permalink