Anyone got example of how to on before save event in backend show a popup, basically want to show a form and capture some data. It can be done for other events as when you do protect page, roll back etc you get a popup.
public class OnSaveEventSample : ApplicationBase { public OnSaveEventSample() { Document.AfterSave += new Document.SaveEventHandler(Document_AfterSave); }
I have this working however when the pop up comes up the page continues to save take it i would before showing popup cancel the event and after doing by bit re fire the event though not sure how i would stop it from looping?
The properties are saved anyway when you hit the save button. So why not take a different approach. Why not create a custom datatypestore it on the generic properties tab so normal users wouldn't see it and let that capture the data whenm submitting the form?
On save show popup
Guys,
Anyone got example of how to on before save event in backend show a popup, basically want to show a form and capture some data. It can be done for other events as when you do protect page, roll back etc you get a popup.
Regards
Ismail
Ismail:
Not tried but at a guess something like:
Though I'm not sure at what point in the page lifecycle the event handler is called.
Let me know how you get on.
This would be an interesting one.
If you have problems then there is an event that is raised everytime a page in the GUI is rendered.
You could set a flag on the event and tap into that maybe.
Hi Ismail,
I would propose something like:
- Morten
Actually looks as though you should just be able to do:
Ups .. and I wrote AfterSave.
Try it out with Document.BeforeSave += new Document.SaveEventHandler(Document_BeforeSave); instead
Looking at how the Save-method is setup it would appear that you have access to the same properties as with AfterSave:
- Morten
Guys,
Many thanks will try both ways when i get a moment.
Regards
Ismail
Hello,
I have this working however when the pop up comes up the page continues to save take it i would before showing popup cancel the event and after doing by bit re fire the event though not sure how i would stop it from looping?
Regards
Ismail
I guess you'd need to set a session variable.
Check if session["cancelPublish"] exists if not then cancel the event and set it.
If it does exist then null it and continue with the event.
That way, when your modal re-raises the event it should work.
HI Ismail,
The properties are saved anyway when you hit the save button. So why not take a different approach. Why not create a custom datatypestore it on the generic properties tab so normal users wouldn't see it and let that capture the data whenm submitting the form?
Cheers,
Richard
is working on a reply...