Ciao a tutti! sto sviluppando un componente, volendo utilizzare ajax per non far ricaricare tutta la pagina mi si pone questo problema: se ho un testo in una textarea con editor come si può visualizzare l'editor scelto con javascript? vi allego il codice che purtroppo non funziona
<?php
/**
* @version 1.0.0
* @package com_mtt
* @copyright Copyright (C) 2012. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Lorenzo <lory1990@gmail.com> - http://
*/
// no direct access
defined('_JEXEC') or die;?>
<script>
function txt_input(name, value){
document.getElementById(name).innerHTML='<input class="inputbox" name="'+name+'" value="'+value+'" />';
}
function show_fileds(){
this.txt_input('lunghezza', '<?=$this->item->lunghezza?>');
this.txt_input('larghezza', '<?=$this->item->larghezza?>');
this.txt_input('immersione', '<?=$this->item->immersione?>');
this.txt_input('peso', '<?=$this->item->peso?>');
this.txt_input('costruzione', '<?=$this->item->costruzione?>');
this.txt_input('materiale', '<?=$this->item->materiale?>');
document.getElementById('tipologia').innerHTML = "<select name=\"tipologia\"><option value=\"1\" <?php if($this->item->tipologia==1) echo ' selected=\"selected\"' ?>><?=JText::_("COM_MTT_MOTORE");?></option> <option value=\"0\" <?php if($this->item->tipologia==0) echo ' selected=\"selected\"' ?>><?=JText::_("COM_MTT_VELA");?></option></select>";
document.getElementById('descrizione').innerHTML ="<?php
$html = JFactory::getEditor()->display('descrizione', $this->item->descrizione, '100%', '400', '70', '15',true);
$html = str_replace('"','\"',$html);
echo str_replace('\n','',$html);
?>";
}
</script>
<?php if( $this->item ) : ?>
<h1 style="display:inline !important" id="nome"><?=$this->item->nome; ?></h1>
<div style="display:inline" id="edit_icon"><img src="components/com_mtt/assets/edit.png" alt="<?=JText::_("COM_MTT_EDIT")?>" title="<?=JText::_("COM_MTT_EDIT")?>" onclick="show_fileds()"/><>
<div class="item_fields">
<table width="100%">
<tr>
<td valign="top" width="50%">
<ul class="fields_list">
<li><?=JText::_("COM_MTT_LUNGHEZZA"); ?>:
<span id="lunghezza"><?=$this->item->lunghezza;?></span> m</li>
<li><?=JText::_("COM_MTT_LARGHEZZA"); ?>:
<span id="larghezza"><?=$this->item->larghezza;?></span> m</li>
<li><?=JText::_("COM_MTT_IMMERSIONE"); ?>:
<span id="immersione"><?=$this->item->immersione;?></span> m</li>
<li><?=JText::_("COM_MTT_TIPOLOGIA"); ?>:
<span id="tipologia">
<?php if($this->item->tipologia==1) echo JText::_("COM_MTT_MOTORE");
else echo JText::_("COM_MTT_VELA");?></span></li>
<li><?=JText::_("COM_MTT_PESO"); ?>:
<span id="peso"><?=$this->item->peso;?></span> kg</li>
<li><?=JText::_("COM_MTT_MATERIALE"); ?>:
<span id="materiale"><?=$this->item->materiale;?></span></li>
<li><?=JText::_("COM_MTT_COSTRUZIONE"); ?>:
<span id="costruzione"><?=$this->item->costruzione;?></span></li>
</ul>
<p></p>
<div id="descrizione"><?=$this->item->descrizione; ?><>
<?php
if(count($this->item->appuntamenti)!=0):?>
<p style="font-weight: bold; font-size:12pt"><?=JText::_("COM_MTT_PROSSIMI_APPUNTAMENTI")?></p>
<ul>
<?php foreach($this->item->appuntamenti as $app):?>
<li><a href="index.php?option=com_jevents&view=icalrepeat&layout=detail&evid=<?=$app->evdet_id?>"><?=$app->summary?></a> <?php if($app->location!="") echo " - " .$app->location; ?></li>
<?php endforeach;?>
</ul>
<?php endif; ?>
</td>
<td>
<?php
if(count($this->item->id_phoca)!=0):?>
<a href="index.php?option=com_phocagallery&view=category&id=<?=$this->item->phoca_cat?>">
<div id="slideshow">
<?php foreach($this->item->id_phoca as $phoca):?>
<img
style="";
src="images/phocagallery/<?=$phoca?>"
height="200"
alt="<?=$this->item->nome?>"
title="<?=$this->item->nome?>"
/>
<?php endforeach;?>
<></a>
<?php endif; ?>
</td>
</tr>
</table>
<>
<?php endif;?>