Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 2 min read

Support

Motivation

You want to be able to add HTML markup to a textarea.

Method

We will use the CKEditor JavaScript libraries. This demo was done using version 3.2.

Steps:

  • Download the source code from: CKEditor web site.
  • Uncompress the zip file on your local file system
  • Change any occurrences of "&" to & a m p ; and remove & n b s p ; and & c o p y ; in the HTML files to make the files well formed XHTML files so that eXist can index them. The following files in the 3.2 release will need to be modified:

ckeditor/CHANGES.html

  • ckeditor/_source/plugins/wsc/dialogs/ciframe.html
  • ckeditor/_source/plugins/wsc/dialogs/tmpFrameset.html
  • ckeditor/plugins/wsc/dialogs/ciframe.html
  • ckeditor/plugins/wsc/dialogs/tmpFrameset.html
  • Drag the main ckeditor folder into eXist. It should immediately index all html files and store all non-XML files (javascript, css etc.) as binaries.
  • Note: this does not seem to be possible. Change the Configuration file to not encode the XML.

Failure to follow these step 3 above will result in the following error message:

XMLDB exception caught:
Failed to invoke method parse in class org.exist.xmlrpc.RpcConnection:
org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.

This can be attempted by editing the config.js file.(see Config File Parameters )

  • Add the following line to config.js
    config.HtmlEncodeOutput = 'false';
  • Replace the sample_postdata.php with the following sample_postdata.xq

Sample XQuery to Echo Post Data

In the _samples folder you will find several samples of how to use CKEditor. Each of these HTML files has an HTML form
with the following line:

<form action="sample_posteddata.xq" method="post">

The following program can be used as a substitute for the sample_postdata.php file.

sample_postdata.xq

xquery version "1.0";
declare option exist:serialize "method=xml media-type=text/xml omit-xml-declaration=yes indent=yes";

(: Get the content of the editor1 parameter :)
let $editor1 := request:get-parameter('editor1', '')

(: wrap the content in a div to make sure we have well-formed XML :)
let $wrapped-content := concat('<div>', $editor1, '</div>')

(: parse the escaped text so that we now have true XML markup :)
let data-to-save := util:parse(wrapped-content)
return

{$data-to-save}

Configuration File for XML Systems

CKEditor has a very large number of configuration options. They are set by editing the config.js file in the main CKEditor directory.

The following changes to the CKEditor configuration file should work but it does not seem to have the correct behavior.

config.js

CKEDITOR.editorConfig = function( config )
{
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';

// This should turn off encoding of the XML files as they are sent to the server
config.HtmlEncodeOutput = false;
config.entities = false;
};

Where this page came from

This page was imported from Wikibooks. From “XForms” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.

Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.

Get each new page of

XForms

Following means one email when a page is added, nothing when a page changes.

Following means one email when a page is added, nothing when a page changes.

Comments

Spinner Logo

Next in XForms

CC BY-SA 4.0
This updates the visible image. Note that the output must have a the mediatype set to be **image/*** for the browser to render the link as an image correctly. ## Attribution This example was created by Chris Wallace and the University of Western England.
CC BY-SA 4.0
The way to visualize this is to imagine a set divided into two distinct subsets: selected and un-selected items. As an item moves from the un-selected item set to the selected item set it must first be added to the new set and then deleted from the old set. ## Method This example uses a combination
CC BY-SA 4.0
XForms, Deep Copy with Insert Origin
CC BY-SA 4.0
The real power, and simplicity, of the form is in the value attribute of the xforms-setvalue element which itself is placed inside an xforms-trigger: value="concat(//text,'whatever you desire goes here')" ## Sample Program <html xmlns=" xmlns:xf=" xmlns:ev=" <head> <title>Insert BB code</title> <sty
CC BY-SA 4.0
This way if the user want to only make a simple change to the form only the logic for a single tab needs to be loaded. ## Example We will use a series of triggers that are styled as file tabs. Each trigger will perform two actions: it will run a save submission and it will then load the next part of
CC BY-SA 4.0
The user can check any number of items on the left list and press the Move Right button to move these items to the right list. The user can also add any number of items on the right list and then by pushing the Move Left button, these items would be moved to the left list. Note that a "move" is tech