How to link reviews to specific CMS item

Hello, here’s my problem. I have a cms collection for the reviews which is called “avis”. And a collection for the different spectacles. When I submit the form to add a review for a specific spectacle and on its page, it adds it on the spectacle cms template. So the review is visible for every spectacle.

And I want to display the review ONLY on the spectacle page where I submit it. And I can’t find how to do it… Maybe with an ID or something. I don’t know :exploding_head:
Can you please help me with this ?

I cannot recall if Webflow completed this capability in Logic, so you may hit a dead end with this approach.

However the basic approach you need it to pass the spectacles slug into logic, and then set the ref for your review with it. The process looks like;

In your page;

  • Add a text input to your form, named something like Spectacle
  • Give it an ID
  • Use a small piece of custom code to set the value of that input with the current spectacle’s slug
  • Hide the field

In logic;

  • Apply the slug as the reference item in creating your new review. You may need to do a lookup step first to get the ID for that spectacle.

Thanks a lot for your answer. Is the custom code essential (I’m not developper, just some knowledges :sweat_smile:) ? Because I saw that with my input I could select the slug of my spectacle from my collection with the ID :

And I’m not sure on how to use that slug as the reference item in creating my new review in logic. If you could be a little bit more precise that would be nice. Thanks :smiley:

You need to set the value of the Input to your slug, and Webflow does not have Input value data-binding. However you can use this lib to set the value. Just add the lib and then on your input field, you’d add a custom attribute of x-value data-bound to the CMS slug.

Like I said, I’m not even certain if current Logic has sorted this out. You’ll either just set it, or you’ll need to add a find setup to lookup that slug and get the ID. Try both.

Ok thanks and sorry I’m a little bit lost, so I add your lib and add the custom attribute to the CMS slug (I think so) :

Then I’m stuck… I thought about use a filter on the cms item review in its settings, for example filter if the review item spectacle-id value = actual slug. But I doesn’t seem to be possible.

It feels like I’m close to find the solution but… no :sweat_smile: