Submit data from the frontend
Overview
The ViewComponent
framework does not support posting data from the frontend. Instead, you must make a web service call using either JavaScript or AJAX.
You can do that using the built-in Forms module to capture the data on the frontend or you can build your own custom controller to do this.
Use the built-in Forms module
Sitefinity ASP.NET Core Renderer has an out-of-the-box form functionality for submitting data to Sitefinity CMS.
The Renderer is integrated with the WYSIWYG editor for building custom forms. You can create a form using the built-in form widgets or create custom ones. Then, you place the form on a page and the form widget takes care of passing the data to the CMS.
For more information, see Create forms.
If you need some additional processing, you can intercept the form submission and attach to the CMS API IFormEntryCreatedEvent
and do some processing there.
For more information, see Forms events.
Use a custom controller
If you do not have access to Sitefinity CMS or you want to post data to an external application, you can achieve this with a custom controller using the following process:
- Build your own custom controller in the ASP.NET Core Renderer.
- Submit your data.
- Use the
IFormSubmissionClient
to pass the data to your database or a service.
Alternatively, you can leverage Blazor components for integrating client-side and server-side code.
For more information, see the Blazor sample on Sitefinity GitHub repository.