My Account   Contact Us    
  
» HomeProductsSupportDeveloper CommunityCompany
The save custom button example

Add a save button to the toolbar that submits the form


Often, ActivEdit may be presented in a form as a pop-up to conserve space. Adding a save button to the toolbar in this instance has been popular. This article will cover the code needed in the form page to launch a pop-up containing ActivEdit, pass a string from a form variable to ActivEdit in the new window, add the save custom button to the ActivEdit toolbar and write the resulting string back to the form variable and close the pop-up when the save button is pressed.

The custom button API is implemented in ActivEdit 3.0 and higher.

If save.gif isn't found in /inc/images/custom , copy it to that location from /inc/images.

simple.html

<html>
<head>
 <title>A simple example</title>
 <script language="javascript">
  function editContent() {
   window.open("/support/faq/gocfm/id/73/editor.html", "contentWindow", "height=450,width=450,status=no,toolbar=no,menubar=no,location=no");
  }
 </script>
</head>

editor.cfm

<html>
<head>
 <title>ActivEdit</title>
</head>

<script language="JavaScript">

function aeapi_custom_save(AeNum) {
 ae_onSubmit();
 window.opener.content.innerHTML = aeObject.DOM.body.innerHTML;
 window.close();
}

function aeapi_local_onLoad(aeObject, fieldname) {
 aeObject.DOM.body.innerHTML = window.opener.content.innerHTML;
}
 
</script>

<body>

<form name="noMatter" method="post" acceptcharset="utf-8">
 <cf_activedit
  name="content"
  inc="/activedit/inc/index.html"
  toolbar="save,font,bold,italic,underline,paste,replace"
  width="400"
  height="400">
 </cf_activedit>
</form>

</body>
</html>

 

Search Knowledge Base:
Sign up for our newsletter: | Subscribe with RSS: RSS
© ActivSoftware 1999 to 2005 | Privacy Statement