Differences between revisions 3 and 4
Revision 3 as of 2005-07-19 13:34:42
Size: 2072
Comment:
Revision 4 as of 2009-09-20 23:27:16
Size: 2072
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

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.

HowToEditFormsWithKupu (last edited 2009-09-20 23:27:16 by localhost)