Form action leads to the right url, but with the wrong front matter variables


#1

EDIT: I have a jekyll site store that uses one form layout that is for 3 different product pages by using jekyll collections to apply variables to modify the form contents while using the same form layout.

This works great but I want each form to link its own custom success page. I’ve been trying to do this by using the “action” attribute in the tag in the source layout file.

When the form is sent, it successfully links to the corresponding custom url for each of the different product pages. The problem is that although the browser goes to the correct url, it displays the Netlify default success page:
New photo by Regina Clarkinia

Or alternately, sometimes it inexplicably displays one of the product pages, but it’s always the same one even when it’s not that product that was chosen. The url is “…/tarotcart” so the info should be for a tarot reading, yet the product info is for the career chart.: https://photos.app.goo.gl/St4wn8pVkDnjibVD7

So basically, my question is: how can I get the browser to display the correct success page for these product forms?

Summary

The problem is that the payment page shows the wrong product details (the front matter variable from another product).

Here’s a link to the tarot payment page.
https://www.clarkiniaastrology.com/purchases/tarotcart
This link displays the correct product, price and description (according to front matter variables). However when this page is accessed via the tarot reading product page form action (https://www.clarkiniaastrology.com/readings/tarot/) the variable info is for the wrong product: the career chart product, even though it’s supposed to be the tarot reading url.

Here’s a screenshot of my browser after choosing a tarot reading from the tarot product page. The url is “…/tarotcart” so the info should be for a tarot reading, yet the product info is for the career chart.
https://photos.app.goo.gl/St4wn8pVkDnjibVD7

Not sure if this is a problem with how the product page form action is set up. Or if it’s how the front matter variables are being accessed on the payment page. Or something completely different.

Thanks for your help. Hope this makes sense.

Here’s the form code:


#2

have you asked netlify? it sounds like an issue with their form. I have never used it so not sure.

Keep in mind jekyll is building you a static site - there is no brain, just static files, so it can’t decide anything on its own. Netlify allows a static site to use a form, but netlify is handling all the processing/actions for the form I would assume.


#3

Thanks rdyar. You’re right on the money - it’s a static vs dynamic issue. I guess that making each form it’s own deal will solve it (instead of running the collection front matter variables through the same layout template like I am now).

I asked Netlify and they got back to me with this:

“You won’t be able to have different action props for forms with the same form-name. This is because our form-handling’s form definitions are not dynamic. It will only take the first version of the form (based on form-name) as the definition and all the rest would be handled the same. I would recommend changing the form-names along with the action props. Each form will then be handled as separate forms.”