Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
run IWDatacapture.save() in close button?
System
When the user clicks the close button, I want a simple javascript confirm dialog that prompts her to save, and then either saves (on OK) or does nothing (on cancel). The javascript part is easy enough, but how can I get IWDatacapture.save() to run?
-M.
Find more posts tagged with
Comments
Migrateduser
In your iw.cfg file make sure you have the following.
[teamsite_templating]
enable_formapi=true
Then run the following from a command line.
iwreset -a
The add the following to the datacapture.cfg you want to use after the <ruleset> tag.
<script src="/iw/userscript/validate.js"/>
Then create the validate.js file in your iw-home/httpd/iw/userscript folder (create the userscript folder if it doesn't exist)
Your code should be something like this.
IWEventRegistry.addFormHandler("onSave", saveHandler);
function saveHandler(button) {
switch (button) {
case IWDatacapture.SAVEAS_BUTTON:
{
// do something;
return true;
}
case IWDatacapture.SAVECLOSE_BUTTON:
{
// do something;
return true;
}
case IWDatacapture.SAVE_BUTTON:
{
// do something;
return true;
}
}
}