cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniele Madama (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COCOON-1314) Validation on HTMLArea fields doesn't work correctly
Date Mon, 02 Oct 2006 10:25:21 GMT
    [ http://issues.apache.org/jira/browse/COCOON-1314?page=comments#action_12439086 ] 
            
Daniele Madama commented on COCOON-1314:
----------------------------------------

Hi,
I try with the actual 2.1.10-dev (Revision: 451904) and I check the htmlarea sample at http://localhost:8888/samples/blocks/forms/htmlarea;
I don't get the '<br/>' tag but a 'nbsp;' in the data1 response. 
Lookin for where it get this value, I  see at src/blocks/forms/resources/org/apache/cocoon/forms/resources/htmlarea/htmlarea.js,
changing in the follow way

Index: src/blocks/forms/resources/org/apache/cocoon/forms/resources/htmlarea/htmlarea.js
===================================================================
--- src/blocks/forms/resources/org/apache/cocoon/forms/resources/htmlarea/htmlarea.js   (revision
451904)
+++ src/blocks/forms/resources/org/apache/cocoon/forms/resources/htmlarea/htmlarea.js   (working
copy)
@@ -2038,7 +2038,7 @@
            case 3: // Node.TEXT_NODE
                // If a text node is alone in an element and all spaces, replace it with an
non breaking one
                // This partially undoes the damage done by moz, which translates '&nbsp;'s
into spaces in the data element
-               if ( !root.previousSibling && !root.nextSibling && root.data.match(/^\s*$/i)
) html = '&nbsp;';
+               if ( !root.previousSibling && !root.nextSibling && root.data.match(/^\s*$/i)
) html = '';
                else html = HTMLArea.htmlEncode(root.data);
                break;
            case 8: // Node.COMMENT_NODE

So I can check the correct value of the form and use the required attribute of the widget.
I don't know in this modify has other side-effect.


With the above and following patch the sample work correctly

Index: src/blocks/forms/samples/flow/htmlarea.js
===================================================================
--- src/blocks/forms/samples/flow/htmlarea.js   (revision 451948)
+++ src/blocks/forms/samples/flow/htmlarea.js   (working copy)
@@ -22,9 +22,10 @@
     form.showForm("htmlarea-display-pipeline");
 
     var model = form.getModel();
+    var data2 = model.data2 != null ? new Packages.org.apache.cocoon.xml.StringXMLizable(model.data2)
: null;
     var htmldata = { 
                       "data1" : model.data1,
-                      "data2" : new Packages.org.apache.cocoon.xml.StringXMLizable(model.data2)
+                      "data2" : data2
                    }
     cocoon.sendPage("htmlarea-success-pipeline", htmldata);
 }

Tnks

> Validation on HTMLArea fields doesn't work correctly
> ----------------------------------------------------
>
>                 Key: COCOON-1314
>                 URL: http://issues.apache.org/jira/browse/COCOON-1314
>             Project: Cocoon
>          Issue Type: Bug
>          Components: Blocks: Forms
>    Affects Versions: 2.2-dev (Current SVN)
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Reinhard Poetz
>         Assigned To: Cocoon Developers Team
>
>  

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message