You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2004/08/30 11:48:33 UTC

Customizing HTMLarea for a single form element

I have tried the following (without success) to customize 
the  HTMLarea script for a single form element...

In the calling page of the form:

    <script type="text/javascript" >
      //reconfigure HTMLArea toolbar
      function initFunction(areaID) { 
        // inititalize editor 
        editor = new HTMLArea("editor"); 
        // retrive the config object 
        var config = editor.config; 
        // do custom configuration
      	config.toolbar = [
	[ 
	  "bold", "italic", "underline", "strikethrough", "separator",
	  "subscript", "superscript", "separator",
	  "copy", "cut", "paste", "space", "undo", "redo" ],
	[ "justifyleft", "justifycenter", "justifyright", "separator",
	  "lefttoright", "righttoleft", "separator",
	  "insertorderedlist", "insertunorderedlist", "outdent",
"indent", "separator", "separator",
	  "createlink"  ]
      	];    
        HTMLArea.replace(areaID,config);
      }
    </script>


and in the form template:

    <ft:widget id="ind_desc"><fi:styling style="width:90%;"
type="htmlarea" 
rows="10"/><ft:initFunction>initFunction</ft:initFunction></ft:widget> 


It *appears* as though this should be processed b the 
forms-htmlarea-styling.xsl stylesheet here:

    <xsl:choose>
      <xsl:when test="fi:styling/initFunction">
        <script language="JavaScript"><xsl:value-of
select="fi:styling/initFunction"/>('<xsl:value-of
select="@id"/>');</script>
      </xsl:when>
      <xsl:otherwise>
        <script language="JavaScript">HTMLArea.replace('<xsl:value-of
select="@id"/>');</script>        
      </xsl:otherwise>
    </xsl:choose>

but the form ends up with:

<script language="JavaScript">HTMLArea.replace('ind_desc');</script>   


and not the expected:

<script language="JavaScript">initFunction('ind_desc');</script>    

I have also tried :

    <ft:widget id="ind_desc"><fi:styling style="width:90%;"
type="htmlarea" 
rows="10"/><initFunction>initFunction</initFunction></ft:widget>  

without success.

Any pointers or suggestions here would be welcome!

Thanks
Derek

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Customizing HTMLarea for a single form element

Posted by Bruno Dumon <br...@outerthought.org>.
On Mon, 2004-08-30 at 11:48, Derek Hohls wrote:
> I have tried the following (without success) to customize 
> the  HTMLarea script for a single form element...
> 
> In the calling page of the form:
> 
>     <script type="text/javascript" >
>       //reconfigure HTMLArea toolbar
>       function initFunction(areaID) { 
>         // inititalize editor 
>         editor = new HTMLArea("editor"); 
>         // retrive the config object 
>         var config = editor.config; 
>         // do custom configuration
>       	config.toolbar = [
> 	[ 
> 	  "bold", "italic", "underline", "strikethrough", "separator",
> 	  "subscript", "superscript", "separator",
> 	  "copy", "cut", "paste", "space", "undo", "redo" ],
> 	[ "justifyleft", "justifycenter", "justifyright", "separator",
> 	  "lefttoright", "righttoleft", "separator",
> 	  "insertorderedlist", "insertunorderedlist", "outdent",
> "indent", "separator", "separator",
> 	  "createlink"  ]
>       	];    
>         HTMLArea.replace(areaID,config);
>       }
>     </script>
> 
> 
> and in the form template:
> 
>     <ft:widget id="ind_desc"><fi:styling style="width:90%;"
> type="htmlarea" 
> rows="10"/><ft:initFunction>initFunction</ft:initFunction></ft:widget> 
> 
> 
> It *appears* as though this should be processed b the 
> forms-htmlarea-styling.xsl stylesheet here:
> 
>     <xsl:choose>
>       <xsl:when test="fi:styling/initFunction">
>         <script language="JavaScript"><xsl:value-of
> select="fi:styling/initFunction"/>('<xsl:value-of
> select="@id"/>');</script>
>       </xsl:when>
>       <xsl:otherwise>
>         <script language="JavaScript">HTMLArea.replace('<xsl:value-of
> select="@id"/>');</script>        
>       </xsl:otherwise>
>     </xsl:choose>
> 
> but the form ends up with:
> 
> <script language="JavaScript">HTMLArea.replace('ind_desc');</script>   
> 
> 
> and not the expected:
> 
> <script language="JavaScript">initFunction('ind_desc');</script>    
> 
> I have also tried :
> 
>     <ft:widget id="ind_desc"><fi:styling style="width:90%;"
> type="htmlarea" 
> rows="10"/><initFunction>initFunction</initFunction></ft:widget>  
> 
> without success.
> 
> Any pointers or suggestions here would be welcome!
> 
> Thanks
> Derek

try

<ft:widget id="ind_desc">
  <fi:styling style="width:90%;" type="htmlarea" rows="10">
    <initFunction>initFunction</initFunction>
  </fi:styling>
</ft:widget> 

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org