Have some HTML form elements on a page but still want users to edit the page for various reasons without ruining the HTML form? Well, by default, Kupu in Lenya will remove most of the attributes to input
tags, specifically the name
and type
attributes. It also removes all form tags in general. How to fix this? Just change two files.
Step 1: Update kupucontentfilters.js
Edit the file $LENYA_HOME/resources/kupu/common/kupucontentfilters.js
with your favorite editor. Look for some lines that look like this:
if (arguments.length) { // allow an optional filterdata argument this.filterdata = arguments[0]; } else { // provide a default filterdata dict this.filterdata = {'html': 1, 'body': 1, 'head': 1,
You'll notice that none of the tags for forms are listed here. You'll need to add the following anywhere in the list (since the list is initially in alphabetical order, I stuck with that scheme to make it easier):
'button': 1, 'fieldset': 1, 'form': 1, 'input': 1, 'label': 1, 'option': 1, 'optgroup': 1, 'select': 1, 'textarea': 1,
Or simply limit the tags to whatever you want - just be aware that whatever tag you don't list here will be removed if it gets saved in Kupu. Save and exit.
Step 2: Update kupusave.xsl
Edit the file $LENYA_HOME/resources/kupu/apache-lenya/lenya/kupusave.xsl
with your favorite editor. Look for some lines that look like this:
<xsl:template match="@shape"/> <xsl:template match="@align"/> <xsl:template match="@name"/> <xsl:template match="@type"/>
Simply remove the last two lines above for @name
and @type
and save. Now your input items should save without any problems.