Create a web form with a form response editor
This is a tutorial for creating a web form for editing form responses on the frontend.
1. Create the form
- In Sitefinity CMS backend, click Content»Forms» Create a form .
- In Titlefield, enter My test form and click Create and go to add content.
- Drop three Textboxwidgets on the form.
For each widget, click its Editbutton and perform the following:- Set the label of the first widget to Editable Textboxand save your changes*.*
- Set the label of the second widget to Hidden textboxand click the Advancedbutton.
In HiddenModesfield, enter update . This will hide the textbox when the form is rendered in update mode.
Save your changes. - Set the label of the third widget to Readonly textboxand click the Advancedbutton.
In ReadOnlyModesfield, enter update . This will make the textbox read-only when the form is rendered in update mode. - Save your changes.
- Publish the form.
2. Display the form on a page
- In Sitefinity CMS backend, click Pages»Create a page.
- In Name field, enter
Form Pageand click Create and go to add content. - Drop the Formwidget on the page and click Select a form.
- In the dialog that opens, select My test form and click Done Selecting.
- Publish the page.
3. Create the FormsEntryEditor web form
To keep this example simple, this web-form contains a simple GridView which lists the form's responses, each is presented with an "edit" button, which opens the form's page to edit the values of the editable fields.
In Visual Studio, add a new web form user control to your website and name it FormsEntryEditor.
Edit the markup file
EXAMPLE: For more information about the markup of the widget, see
FormsEntryEditor.aspxin Sitefinity documentation-samples on GitHub.:
Edit the code-behind file
EXAMPLE: For more information about the markup of the widget, see
FormsEntryEditor.aspx.csin Sitefinity documentation-samples on GitHub.:
NOTE: Note the following:
- The form is retrieved by its name.
If your form is not found, make sure you locate it properly.- The grid is bound to 4 dynamic fields.
The first is the Queryfield, which is generated for each record, and hidden when the grid's rows are created.- The ID of each form field is retrieved by its Name for developers.
It may vary on your system.
To get the ID of each field, edit the textbox in the form editor and expand the Advanced: Name for developers.
Result:
- In addition to the dynamic columns created by the binding in the code-behind file, the grid has one static column. This column contains the e dit button.
- The button holds the generated query for each record in its data-query attribute.
- When the button is clicked, the page redirects to the page which holds the form, and appends the relevant query.
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.
Get started with Integration Hub | Sitefinity Cloud
This free lesson teaches administrators, marketers, and other business professionals how to use Sitefinity Integration Hub to create automated workflows between Sitefinity and other business systems.
Web Security for Sitefinity Administrators
This free lesson teaches administrators the basics about protecting your Sitefinity instance and your sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
Foundations of Sitefinity ASP.NET Core Development
The free on-demand video course teaches developers how to use Sitefinity ASP.NET Core and take advantage of its decoupled architecture and modern development model.