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.

Edit Form Object

  1. Hey guys,

    I used Gravity Forms to create huge (massive) forms for an insurance client. After a lot of debugging and manual work the forms are almost working but i need to make a couple of changes to all 14 forms and doing it through the form editor is impossible.

    I'm trying to get the form from the db from "wp_rg_form_meta.display_meta", unserialize it, edit the fields manually, serialize it and update the db. But the unserialization process is not working for most of the forms.

    When I try to unserialize one form I get an error like this one:
    `Notice: unserialize(): Error at offset 2 of 52 bytes in file.php on line 130

    I've only got one form to unserialize properly, which tells me it has something to do with the data.

    I checked GF code to see if you had anything special going on with the serialize/unserialize process, but you use the standar functions.

    The forms all work fine when I preview them, so I have no idea what's the difference between your code and what I'm trying to do.

    Have you encounter this problem before? Is there anything you can do to help?

    Here's a link to an export of two of the forms:

    ATV is one of the forms that works fine when I unserialize it
    Auto is one of the forms that fails to unserialize

    I'd appreciate anything you can do. Thanks in advance.

    Posted 9 years ago on Monday July 25, 2011 | Permalink
  2. I'll have our lead developer take a look at this and respond. He won't be in the office until later this afternoon, so watch for a response sometime them with input from him.

    Posted 9 years ago on Tuesday July 26, 2011 | Permalink
  3. I am not sure why your serialization isn't working. Like you have seen, if you can save the form via the Editor, it is performing a serialization. I am not sure why you would get an error.
    However, I am not sure that is the best way to do this as manually changing that serialized string is very prone for errors. A better alternative would be to export the form, change the XML and re-import the form. Then update the form IDs of your new form to match the old form (so that your entries get associated to the newly imported form)

    Posted 9 years ago on Wednesday July 27, 2011 | Permalink
  4. @Alex thanks for your reply, I'm totally going to try the XML solution.

    My original plan was to unserialize the data, modify it (as a PHP object) and serialize it back. The unserialize process is what was failing. I was doing everything outside of WordPress, so I'm also going to try to do it inside WP using the GF functions.

    I'll let you know how it goes. Thanks again.

    Posted 9 years ago on Wednesday July 27, 2011 | Permalink