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 Function Calls

  1. thaikick
    Member

    Hello, this is my first enquiry here....

    I am trying to add a "custom field" hidden entry to a form that will parse to a post's custom field the value of another field in the same form...

    for example, working on a form that creates a post, i have added a "single line text" entry and add it to the post's custom fields too...

    Is it possible? Thank you very much

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  2. I'm not 100% sure what you are trying to do.

    If you are working on a form that creates a post, only the fields in the Post Fields toolbox will create Post data. See this screenshot: http://i.imgur.com/02Vyg.png

    So you would add a Title and Body field to your form for the Post Title and Post Body. Edit and configure their options. Then if you want to populate a Custom Field you would add a Custom Field from the Post Fields toolbox for each custom field you want to create.

    When you add a Custom Field to your form you can edit it and choose what kind of field it is. You also configure the custom field name (meta key) used to store the custom field. You choose from existing values or you can type in a new value.

    When the form is submitted those fields will be used to create a post based on the settings you configured.

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  3. thaikick
    Member

    thank you for the reply carl...

    I would like to add a custom field that retrieves it's value from another text field above...

    for example...while filling the form, i add the value "thaikick" into a text field and i'd like also to be added into the post's custom field.

    Sorry for my bad english :(

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  4. Why do you need 2 fields to handle that? The Post Fields you add to your form are already going to be captured with the entry data and viewable as part of the entry. So i'm not entirely sure why you need to add 2 fields and populate the 2nd with the value of the 1st.

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  5. thaikick
    Member

    I want to capture a text that is not from the post field...it is "simple text".

    is it possible?

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  6. I'm still not entirely sure what you are trying to do. The Simple Text field is just a text input. The Custom Field can also be configured as a text input. The only difference is the Custom Field data gets used to create a custom field when the form creates a post.

    What you want to do is possible using the content template functionality of the Custom Field that is available in the Post Fields toolbox.

    - Add a Single Input field to your form, give it a field label of whatever you want.
    - Add a Custom Field from the Post fields to your form, give it a field label of whatever you want.
    - Save your form
    - Select continue editing
    - Now edit the Custom Field you added
    - For Custom Field Name and choose an existing custom field name or select New and type in the name. This is the key that is used to store that custom field. It should not contain any spaces or special characters.
    - Check the "Create content template" checkbox
    - Clear the value of the content template so it is empty. Now in the "Insert form field" drop down above it, select the Single Input field you want to populate the value of this custom field with. See this screenshot: http://i.imgur.com/BSxBe.png
    - Select the Advanced tab
    - Select "Admin Only" under visibility
    - Save your form

    If you followed the steps above properly, when you submit the form that Custom Field will be hidden and it will be populated with the value of the other Single Input Field on your form when the post is created.

    But again, I don't see why you need to do this with 2 fields. Having one field that simply populates another is redundant.

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  7. thaikick
    Member

    I need to do this because the post is generated by a form.
    I don't want to be formatted (styled) from the beginning (after submittion )because i am not sure about the style
    I want to pull directly from the corresponding to the post form entry, or from the generated post custom fields values to fill the template.
    I choose custom fields because i know how to do it.

    Can you point me to another way?

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  8. The problem is how you are describing things it isn't clear what you are asking.

    If you want to dynamically populate a form field with the value of a custom field you can use the Default Value option under the Advanced tab when editing the field you want to populate and enter a merge tag for the custom field you want to use to populate the field value with.

    Here is a forum post that discusses something similar:

    http://www.gravityhelp.com/forums/topic/get-routing-email-address-via-post-custom-field#post-32303

    That forum post doesn't do EXACTLY what you want to do, but it does something very similar. It explains how to populate the value of a form field using a custom field value from the post the form is displayed on.

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  9. thaikick
    Member

    Ahh...Thank you very much Carl ! Is there any other way to populate a form field ?

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  10. Along with using merge tags in the default value of a field, you can dynamically populate form fields using PHP or by passing data to the page via the query string.

    You can find a bunch of tutorials on how to dynamically populate fields in the How To section of the Documentation here:

    http://www.gravityhelp.com/documentation/page/How_To

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink