• I’d like to set up a page where a user can select a choice from a dropdown built from entries in a DB and have that selection populate fields later in the form. I got the first part figured out from your “Create a Form Drop-Down with values from CFDB submissions” page, thanks!

    The next part is using that data to fill out other fields. I’ve seen the dynamic text plugins, but they all seem to fail in not being able to put a shortcode within a shortcode.

    For example, on page 1 of the form, the user selects a product from a dropdown. The value is the product ID. The user clicks Next and on page 2 of the form, I’d like to use that ID to pull data like price, description, etc from the DB using cfdb-value and fill in fields. If I could do this all on one page, that would be great, but it looks like most of these plugins are dynamic on page load, so I’m using a CF7 multipage plugin too.

    I can get the value of the field from the previous page with the [multiform product-id] shortcode. But to use that to get another value like product name from cfdb-value, I have to put the shortcode within the shortcode. Like this:

    [cfdb-value form=”Product List” show=”product-name” filter=”ID=[multiform product-id]”]

    This obviously doesn’t work. What I would love is for a user to select an item from a drop down and then have it populate name, description, price fields on the form automatically. I think I’d have to give up on CFDB and use JSON/jQuery for that, though.

    Thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    Thoughts off the top of my head: you can create export links just like shortcodes. You could attach JavaScript (JQuery) to the drop down so that when the user chooses something, the JS does an Ajax call to an to an export link that returns JSON. you inject the filter value into the export link based on the user selection. Then the JS populated other form values from what is in the JSON.

    Thread Starter norelidd

    (@norelidd)

    That’s definitely an interesting take. Last night I figured out how to write a custom shortcode to get what I needed, but I think I’ll supplement it with the cfdb-json shortcode and jquery to build and populate the fields I need.

    Thanks for the reply!

    I’m trying to do almost exactly the same thing. The only difference is that all the fields that I want to populate are on the same page as the dropdown. If you have got it working, I would appreciate some example code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filling fields with data from the DB’ is closed to new replies.