Streaming live at 10am (PST)

Populate form field with CMS content - code not working ugh

I cannot get the field to populate. What am I doing wrong?

Here is my public share link: LINK
(how to access public share link)

No need for jQuery her. Add embed hidden html feild inside your form and that’s it.

The idea her:

Update if this is ok. If not i will look at your page later.

Take it out of the </body> tag and instead add an Embed element to the form. Then add the following inside the Embed element, replacing <add cms Slug field here> with the dynamic cms field you selected:

	var Webflow = Webflow || [];
	Webflow.push(function() {
  		$('#slug').val('<add cms Slug field here>');

Did that fix it?


If not, please double check that ID for your field, in your Webflow Designer, has the same spelling and case:

Screen Shot 2020-03-22 at 1.37.53 AM

Hey Chris,

I have a question to add on to your code. I am using the code dynamically. A problem that I have ran into is that it only works on the first dynamic input item and does not show correct item.

I have place a collection list within a collection template, so I have had to use an embed as I need the collection items. How do I make the code find the right item and repeat form each item on the list?


Sorry, I’m not following you. Could you provide more detail?

Hey Chris,

Sorry for the late reply and thanks for getting back in touch. So the best way that I can think of getting may point across is with examples :slight_smile:

Here is the share link:

So in the example you can see that I have a Collection list within the a collocation template. The collection list has 5 items within it. In the Collection Holder Template I have placed a collection list that is linked to the “Collection List” showing the 5 Items.

Collection List within the Collection Template “Collection Holder”

5 Items within the “Collection Lists”

Using a form to add the input element and then an embed within the form to add your code you can see that Webflow is a bit confused when the site is published.

When the site is published there is only one result retrieved and it’s the wrong item. It’s getting the last item within the collection and only populates the first input element of the collection list.

So I’m wondering if it is possible to add to the code to find the right item that corresponds to the collection list item.

Hope this makes more scene and thanks again for your help :slight_smile:


@Eben_Meyers I took a very quick peek at what you’ve done, at first glance it’s obvious it won’t work due to the fact that your code is pointing to the same text field id on each embed:


Try changing the ID for each text field and change the corresponding “Input” value on the script.

Hello @ChrisDrit. I have been following your steps and are using the code above. Everything is working great when I only have 1 item showing from the cms. However when I have more than 1 item pulled from the cms it’s the wrong data. I don’t know if it makes sense. I will add screenshots so can have a better idea of what is my issue. I appreciate your help and your time.

Without looking at your read-only site, it sounds like the same issue discussed above. You have ot make your custom code point to unique ID’s.

Hi all, on this is it possible to populate information in a Select Field in the form instead of a Text Field? I can see the code only working to populate CMS fields in Form Text Only Fields. Thanks

See if this helps: How to Webflow: Adding data from Collections to Select Dropdown fields - YouTube

Hello all, thank you for your information. It worked for me!!

Could someone relate to my problem? It’s so strange and I can’t understand it.

Thank you in advanced!!

Nothing, false alarm, it was an internal issue of Webflow. It’s solved now.