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.

custom post field issue

  1. hamedhemmati
    Member

    I use a custom post field as an optional field to show data. The logic checks to see if the user has entered any text in there if so then it displays it. I use the field for post references so users enter the URL of the reference site. The problem I am having is when users leave this field blank through gravity forms it automatically assigns the URL of the blog page as the value.

    Is this an expected behavior?

    Posted 13 years ago on Friday May 6, 2011 | Permalink
  2. Gravity Forms doesn't automatically pre-populate fields, so that isn't expected behavior. Do you have any custom code implemented or have you setup a default value for that field?

    Posted 13 years ago on Friday May 6, 2011 | Permalink
  3. hamedhemmati
    Member

    In the advanced section of the custom field I have the default value set to insert variable and the box is blank. I did find something interesting while playing around. I use the following code for checking to see if the value is blank or not.

    $sourceurl = get_post_custom_values("url"); if ($sourceurl !='' )
    If I echo $sourceurl I get the blog URL but the interesting thing is if I change the code to

    $sourceurl = get_post_custom_values("url"); if ($sourceurl[0] !='' )

    Then the if statement works fine. The only problem is if they don't put http:// for the reference URL then the address that gets echoed is my blog URL + the reference URL.

    Posted 13 years ago on Friday May 6, 2011 | Permalink