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.

When fields change

  1. cgorton
    Member

    I'm using a forms plug-in now with an inconvenient defect and I'd like to know how Gravity forms deals with this.

    Let's say I have a form with 4 checkboxes. A couple months after it starts collecting data, I am asked to add a checkbox, or re-name one, or re-order them. What happens to the data when exporting?

    My problem now is that the column headers get screwed up. If I re-name a field, the old entries assume this new name, too. I've had to resort to creating a new form each time a change is made to preserve the correct data, but it makes for a headache when our data group needs to harvest the data.

    How does Gravity forms deal with this?

    Thanks,
    Craig

    Posted 14 years ago on Monday October 26, 2009 | Permalink
  2. Craig,
    Checkboxes are surprisingly tricky fields, especially when you start changing them on the fly. I am not sure Gravity Forms handles it any better than the plugin you currently use. I am going to explain how our checkbox data is handled with an example.
    Lets say i have a checkbox with two items: "First" and "Second"
    Somebody submits a form with "First" checked.
    If you export the entries for that form, you will get a csv file that looks like the following

    "First","Second"
    "First",""

    Note: First row is a header row.

    Now you decide to add a new item "Third" to that field, and a user submits the form with "First" and "Third" checked. Then your export would look like the following:

    "First","Second","Third"
    "First","",""
    "First","","Third"

    Now you decide to rename "First" to "First Item" and a user submits the form with "First Item", "Second" and "Third" checked. Your export would then look like the following:

    "First Item","Second","Third"
    "First","",""
    "First","","Third"
    "First Item","Second","Third"

    Now you decide to reorder the field so that "Third" comes before "Second". A user then submits a form with "First Item","Second","Third" checked. Your export would look like the following:

    "First Item","Third","Second"
    "First","",""
    "First","","Third"
    "First Item","Second","Third"
    "First Item","Third","Second"

    I hope this answers your question.
    To be honest, I am not sure this is the best way to handle the checkbox field, but it does have the advantage of keeping the history of the submissions so that you don't lose any data (even though the headers get a bit out of sync with the data under it).
    You seem to have a good amount of experience dealing with checkboxes. If you have an opinion on how you would like to see them working, I would love to hear it.

    Posted 14 years ago on Tuesday October 27, 2009 | Permalink
  3. cgorton
    Member

    Thanks for the thorough reply.

    I'm using cForms 11.0 and his handling of checkboxes is no better than what you describe, if not worse.

    In a cForms export, I get all forms data on 1 CSV. Each time a different form is listed, a new header row is created. So, if form 1 was submitted 3 times, then form 2 was submitted 2 times, then another form 1, you'd get a form 1 hear row, 3 rows of form 1 data, a form 2 header row, 2 rows of form 2 data, a form 1 header row and a form 1 data row.

    I usually turn the header rows off for export anyway because sorting by form name is the first thing I do and the header rows don't survive the sort.

    I can't think of a better way to handle it than what you're doing. The history is important. cForms actually writes "-" for unchecked and "1" for checked, which loses the data. (There might be a way around this, I can't recall.) I definitely want the values in there for the history.

    It means that we'll have to parse this carefully when merging into our main databases. That's really what I'm getting at. We take lead gen data and merge it back into a corporate marketing database.

    Are there any ways to write Gravity forms data to external DB's? Or send the data to a service?

    Thanks

    Posted 14 years ago on Wednesday October 28, 2009 | Permalink
  4. Yes. Gravity Form has a hook that can be used to access all field data after a form has been submitted. You could use that hook to write the field values to another DB or send it to a service. We have some code snippets that should get you started.
    You could also do an export of the entry database tables if you prefer to implement it as a batch process instead of realtime.

    Posted 14 years ago on Wednesday October 28, 2009 | Permalink