I am already passing the post-id to the page with the form in the url:
I know I can submit values through the querystring but I rather do not want to use that because it depends on the querystring and the price can be adjusted and also, if someone visits this page directly it does not have the values.
Must be something simple with a hook querying the db for the right values using the post-id (or should it be passed through post for this?) and then passing the values into the GravityForm by add_filter.
I know it can be done and I must be close, but I am not a programmer enough to code it.
I created a rudimentary test site with a Products post type which has a title and includes a price custom field.
I have a View which lists products, and in the output section of that View alongside the title I have an order link.
That takes me to a page where I have my Gravity Form to order the product, which needs the product title and price fields to be pre-filled.
I use URL parameters for this as it is the most natural choice in this case and does not require any custom coding. (See the official GF documentation here: hidden link.)
You could use an alternative method to populate the fields using hooks, but you would still have to pass the post id to the form so that the form knew which product was being ordered, so you might as well pass the fields directly. Using hooks wouldn't solve the problem of anyone visiting the page directly because the form wouldn't know which product to order in any case.
In the GF form I checked "Allow field to be populated dynamically" for both fields and gave them parameters of "the_title" and "price".
So the link from my View to the page with the form needs to look something like this when output: mysite.com/orders/?the_title=PS4&price=399.99
I can generate that link like so in my Loop Output section:
Yes I am aware of that solution like I wrote in my 2nd comment in this thread.
But you are right that the page would still need an Id to load the right product.
Because I do not want the visitor to be able to change the query string (and the price!*) I have decided to give up on this part of the wishlist.
I have spoken to the client and it is no problem for them to add a new page and order-form by hand.
* Although the form does not process the billing, I find it amateurish when the client sees the price set in the URL and beïng able to change it.