By default, the Forms Element's view is in WebForms ascx code under ~\modules\_protected\EPiServer.Forms\Views\ElementBlocks folder. Here is an example to customize the Submit button (wrap the button text in <span>) in Razor code
1- Let's see the Forms.config file, there is a setting: formElementViewsFolder="~/Views/Shared/ElementBlocks"
It means that the custom view code file will be placed here, not the ~\modules\_protected\EPiServer.Forms\Views\ElementBlocks folder.
2- Go to the folder that is in formElementViewsFolder setting, create SubmitButtonElementBlock.cshtml file
3- Write the Razor code for this view as below sample ans save this file.
4- Now, browse the website and see what will be generated:
Great! The Submit text is wrapped by <span> as desired.
Please sign in to leave a comment.