I know that docs here (https://docs.developers.optimizely.com/content-cloud/v1.2.0-forms/docs) says, that "Optimizely Forms is only supported by MVC-based websites and HTML5-compliant browsers.", but still is there any way to make Forms work on non-MVC razor projects on FE side?
Could you possibly use the Conetent Delivery API or Content Definitions API (https://world.optimizely.com/documentation/class-libraries/rest-apis/content-definitions-api/) to retrieve Forms and their Fields and then build the frontend in whatever framework you use. You could also use the Forms Service API to retrieve data. (https://docs.developers.optimizely.com/content-cloud/v1.2.0-forms/docs/using-forms-serviceapi)
@Klappo is your solution headless or are you trying to use a completely different server side rendering engine to the CMS?
If you're going to want to embed the form with an iFrame along those lines, you could potentially look a single MVC Razor page which is designed to hold a single form container block so that you get all of the forms handling out of the box. But this does feel a little hacky.
You could follow Minesh's solution to build the form and then submit the response to the following url as form data. This is based on the EPiServer.Forms.Controllers.DataSubmitController
I would add that I've not needed to do any of the above, but it would be interesting to try.
Have a look at this blog post, it's old but (so are webforms and) it might help...
Thanks everybody for the help!
In the end I was able to implement that. I had to copy Forms cshtml view, override default Forms ViewComponent and fix null ref exceptions (viewcomponent supposes that it is rendered on some page).
I had issues wth the order of view component parts rendering, but, again, I fixed that as well.
Then I was able to load the form by its id and submit some data to epi.