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.

Showing Group Fields in the post

  1. sriganesh

    I have read about the possibility of Group Fields using Conditional Logic from these posts

    I have created a form which collects the list of events.
    Here is its structure

    Event #1
    -Description for Event #1
    -Rules for Event #1
    -Deadline for Event #1
    -Contact for Event #1

    Event #2
    -Description for Event #2
    -Rules for Event #2
    -Deadline for Event #2
    -Contact for Event #2


    I collect this using custom fields and I have included a check box at the end of each event, whether to add a new event. If Yes, the other set of fields would be shown to the user.

    How could I display these custom fields on the post ?

    Should it be like, if this field exists then show the value of that field ?

    Or else, is there an easier way like making the custom field names regularized (eventname1,eventdesc1,eventrules1..... eventname2,eventdesc2,eventrules2.... etc)
    and display them like

    for i=1 to last
    display eventname(i) , event desc(i) , event rules(i) ....

    This is purely php question I guess.
    Any help would be appreciated.

    Posted 9 years ago on Monday August 23, 2010 | Permalink
  2. Yes, you would most likely want to use PHP to check if a value exists. Gravity Forms stores custom fields in the standard custom field format when creating posts so to get help with how to display those custom fields pretty much any tutorial on using custom fields in WordPress will apply.

    Here is the Codex page on Custom Fields:

    If you only want to display the contents of the custom field if a value exists then you would want to wrap it in an if statement checking for a value.

    Also make sure you give each of your custom fields a custom field name in the Gravity Forms form editor. This is used as the key to store the custom field and it's also the key you use when displaying custom fields using PHP.

    Posted 9 years ago on Monday August 23, 2010 | Permalink