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.

Can I fill in a custom field with another custom field info within same form

  1. blogginginc
    Member

    I know that similar questions have been posted before, but I need to be sure if this exactly the same thing I need to achieve.

    I need a custom field to be populated with information from another custom field (specifically image field), all this within the same form.

    Example.

    Field 1: Post Image.
    Field 2: Custom Field.

    When the user uploads the image in the first field, the second field will be populated with the direct image url. Can this be done?.

    Posted 13 years ago on Thursday February 10, 2011 | Permalink
  2. You can do this with the 1.5 development release by using the content template functionality of the Post Custom Field which allows you to create a content template and use field values to generate the value of the field that is stored in WordPress.

    Posted 13 years ago on Thursday February 10, 2011 | Permalink
  3. blogginginc
    Member

    I have the Multi Site Support License, so I guess this option is not available to me.

    Posted 13 years ago on Thursday February 10, 2011 | Permalink
  4. The development release of Gravity Forms v1.5 is available to all users. It's available on the Downloads page. The content template functionality is an option on the Post Custom Field if you are running the 1.5 development release.

    Posted 13 years ago on Thursday February 10, 2011 | Permalink
  5. blogginginc
    Member

    I installed the 1.5 version, and configured the Post Custom Field to be filled in with the Post Image url.

    I suppose that the post custom field should be a hidden field since it will be generated by gravity itself rather than the user, is this correct?. If so, how do i do that.

    Posted 13 years ago on Thursday February 10, 2011 | Permalink
  6. To hide this Post Custom Field do the following...

    - Edit the field
    - Select the Advanced tab
    - Under Visibility select "Admin Only"
    - Save your form

    Posted 13 years ago on Thursday February 10, 2011 | Permalink
  7. blogginginc
    Member

    Done, works perfectly, thanks a lot.

    Posted 13 years ago on Thursday February 10, 2011 | Permalink
  8. mssbeen
    Member

    What did you put into the content template to configure it to retrieve the image url?
    Also can this be done with multiple image uploads?

    Posted 13 years ago on Thursday February 17, 2011 | Permalink
  9. In the content template for the custom field you would use the "Insert form field" drop down that appears just above it and select the image field, it will then show a second drop down to select the size. See this screenshot:

    http://grab.by/90qL

    You pick the size of the image you want to insert into the custom field. Don't pick one of the sizes with the alignment options, those are for when you are inserting it into the post body because it includes the HTML markup to do those standard WordPress alignments. So just pick the size type.

    Once you do that it will then insert a form field variable that will look something like this:

    http://grab.by/90qY

    Now we need to do a minor manual adjustment to the variable. If you leave it as is it's going to put markup in the custom field and wrap the image in an HTML img tag, it isn't going to output just the SRC url to the image itself. To output the SRC url to just the image itself as the value of the custom field we would modify the variable. See this screenshot:

    http://grab.by/90r8

    So by changing our post image variable from something like this:

    {Post Image:3:thumbnail}

    To this:

    {Post Image:3:thumbnail:url}

    It will not output the full URL path to the image rather than the HTML markup that displays the image.

    Please keep in mind the variable names are form specific to my examples above may not work on your form.

    Posted 13 years ago on Thursday February 17, 2011 | Permalink
  10. mssbeen
    Member

    Thank you, for you prompt and detailed response. It works great in my posting form.

    Posted 13 years ago on Thursday February 17, 2011 | Permalink