cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen Reijn <j.re...@hippo.nl>
Subject Re: [jira] Commented: (COCOON-1314) Validation on HTMLArea fields doesn't work correctly
Date Mon, 02 Oct 2006 10:46:24 GMT
> 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.
> 

Hi,

instead of replacing the space with nothing, should it not be replaced 
by ' ' instead of no space? You can remove current paragraph nodes 
(<p>&nbsp;</p>) now that are wanted by a user.

Since HTMLArea is no longer a living project anymore, submitting this 
patch to the cocoon code seems fine to me.

Regards,

Jeroen Reijn

Mime
View raw message