-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Description
Written by Muslim Al-Ali Umbraco HQ - feel free to reach out to me anytime for further discussion.
There is currently 2 issues:
- Withing a virtual page - if you try to render a forms within an RTE in a content node - it will throw value cannot be null errors in the frontend
- If you decide to render the forms directly in the view - when you do a form submission you will run into issues with redirect.
Seems like forms is not picking up the routes from the virtual page.
Steps to reproduce
Backoffice:
- Create 2 document types - a products page (listview) and a product page (should be under the products page)
- In the products page documenttype add a SKU textstring and a RTE
- Create a root node -> Products and a Product item with a SKU value
- Render a form as a macro in the RTE
- Then also try to render it directly in the view
Code:
- Create a controller that inherits from the UmbracoPageController, IVirtualPageController (I have attached my controller)
- Create a get endpoint that gets a specific product by id (Sku)
- Implement the findcontent (make sure it finds the root page (products listview page)
- Create a ControllerComposer and map the endpoints
- Create a TvShow model that inherits from ContentModel
Now try to hit the HttpGet endpoint you created that fetches a product -> you should see the issue.
I have attached my solution to this issue as a reference to re-produce.
(In my solution I use TvShow - you should just use product or w/e you feel like.
FormsVirtualPageIssue.zip

