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.

Populating a form with data from a table?

  1. Denham7
    Member

    Hi,

    I am currently building a WordPress site that sells Training Courses that are delivered at various locations on various dates. I currently have the Training Courses displayed in a simple 5 column table that contains the Course Title, Course Location, Course Date, Price and Offer Price. The table is populated by uploading a csv file.

    I don't just want visitors to view the courses and the relevant information but to click on a selected course title and the site redirect them to a booking [gravity] form that contains the Course Title, Location, Date and Price already pre-populated.

    The issue I have is that I am not a coder and need something relatively simple that will pull the data from the table to the form. I have looked into query string but not had much success and the other thing that puts me off about this method is that I have hundreds of courses and don't really want to have to manually create a unique link for each one.

    I am sure for somebody with coding experience this probably seems a basic request but I have hit a brick wall here.

    If anyone has had experience with working with Gravity Forms to pre-populate event information and has a suggestion I would be most grateful.

    As an alternative to populating a form from data within the table is it a better option to create a Gravity Form for each course title then create a drop down text list that contains the Location and Date that are relevant to that course.

    Thanks

    Jamie

    Posted 11 years ago on Thursday September 6, 2012 | Permalink
  2. You have three choices when attempting to reuse a form and pre-populate with unique data based on where the form is embedded. http://www.gravityhelp.com/documentation/page/Allow_field_to_be_populated_dynamically

    • Query String
    • Shortcode
    • Hook

    Since you have all your data in one page, I don't know of a way to pull individual pieces of data (your 5 columns) automatically. You're going to have to manually craft the link with the query string populated with the same data which is in your row for the one course.

    Maybe you can do some of that work in your CSV before it's imported. I'm not sure how you are converting CSV to table (I know there are a few plugins to do that) but I think instead of your CSV looking like this before it's converted to a table in your page, I would add a column to the CSV and create the link to the page where the Gravity Form is embedded. http://pastebin.com/CnurdJd9

    I would not create a form for each title. I would use one form and populate the data dynamically by using the query string.

    There are other ways to do it, but this is probably the easiest for a non-coder.

    Posted 11 years ago on Thursday September 6, 2012 | Permalink
  3. Denham7
    Member

    Hi Chris.

    Thanks very much for taking the time to reply, the code that you put together really helped. It is going to be quite time consuming but it does the job and an ideal work around for a non-coder.

    Thanks
    Jamie.

    Posted 11 years ago on Thursday September 6, 2012 | Permalink
  4. Great. I've done manual things like this before in Excel or OpenOffice, by using the CONCATENATE() function. Maybe that will work in your case. Or, a lot of copy and paste, Notepad++ or shell command line stuff. If it's just one time, it's less time consuming than revamping how you do everything.

    Posted 11 years ago on Friday September 7, 2012 | Permalink