Add a command in the Page Editor which create an item and Redirect

Today I had to create a button which is displayed in the page editor and do the following logic:

  • Show a dialog asking for a name
  • Create an item under a structure
  • Redirect to a new URL

Easy *.* or not … Well to redirect I saw different ways to do it and I chose this one:

Where str is my url to redirect to. I created my item like this:

(I didn’t put all the checks about the security) But my redirect didn’t work immediately … so I looked into the code of Insert Page and discovered this little instructions which were around the AddItem :

Client.Site.Notifications.Disabled = true & then false. Of course, creating an item into the page editor refreshes the page and so my Redirect was not working and this instruction disabled (if set to true) the refresh of the page (well the notification to the Page Editor that something happened)

I hope this will help you if you have to create a button which creates items from the page editor  😉

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *