0

In SharePoint Online, I have a remote event receiver returning an error message for an ItemUpdating event on two different sites in two different site collections.

In one site, the error message is displayed in red at the bottom of the edit form. This is the behaviour I want. This site was created using C# CSOM and an empty site template.

In the other site, the error message is displayed in a new page with "Sorry, something went wrong" at the top and if the back button is clicked then some of the field data entered is cleared. This site was created with the UI and a team site template.

Any ideas how to change this behaviour?

  • After further investigation I figured out why it is different. The library that displays the error on a new page has multiple content types in the library. Once the edit form has the content type selection drop down it behaves differently. I don't believe I can change this behaviour so I will likely have to live with it. – Rob P Jun 15 '16 at 17:59
0

Sounds like the "CSR Render Mode" is set to "Server" -- unless someone explicitly changed this on purpose, you usually only see this on sites that were upgraded from SP2010. If the Form is set to "Server Render", then the event is not triggered until the page performs a full postback to the server, and thus has to render a whole new page to render the Error.

To fix, navigate to the Edit Form for an item in the list. Then using the settings cog in the upper-right corner, choose "Edit Page". Once in Edit mode, use the WebPart Context menu in the upper-right of the Form to choose "Edit Web Part". This will open the web part tool pane. At the very bottom, under the "Miscellaneous" category, ensure that "CSR Render Mode" is set to "Standard". You will likely want to correct this on the "New Form" page as well if your EventReceiver also handles ItemAdding.

  • Hi. Thanks for the reply. I looked at the CSR Render Mode and it is set to Standard. As I mentioned in my comment above, when the Content Type selector is added to the edit form it seems to require a full postback. – Rob P Jun 17 '16 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.