1

我正在尝试开发一个应用程序,其中“当我从下拉列表中选择选项时,应自动填写以下字段(一个是文本字段,另一个是 TinyMCE Esitor)”。下面是我试过的代码。

<?php
defined('_JEXEC') or die('Restricted access');

?>

 <script type="text/javascript">
function showTemplate()
{   
    document.getElementById("jform_page_title").value = document.getElementById("jform").value;
    alert("clicked");
}

</script>


<form action="" method="post" name="adminForm" id="adminForm">

<table class="admintable">
  <tbody>

 <tr>
    <td>
      <label for="jformid"><?php echo JText::_('JTAG_LEGAL_PAGES_CHOOSE_TEMPLATE');?>
    </label>
    </td>
    <td>
<select id="jform" onchange="showTemplate()">

<?php foreach($this->templates as $template): //print_r($template);exit; ?>
<option value="<?php echo $template->id; ?>"> <?php echo $template->template_title; ?></option> 

<?php endforeach; ?>
</select> 
    </td>   

  </tr>

<tr></tr>


<tr>
  <td>
    <label for="jform_page_title"><?php echo JText::_('JTAG_LEGAL_PAGES_TEMPLATE_TITLE'); ?></label>
  </td>
  <td>
    <input type="text" size="30" class="inputbox required" id="jform_page_title" value="<?php echo $this->template->template_title; ?>" name="jform[page_title]" />
  </td>
</tr>

<tr></tr>

<tr>
  <td>
    <label for="jform_description"><?php echo JText::_('JTAG_LEGAL_PAGES_TEMPLATE_DESCRIPTION'); ?></label>
  </td>
  <td>
    <?php
    $editor =& JFactory::getEditor();
      echo $editor->display('jform[description]', htmlspecialchars($this->lpsettingdata->description, ENT_QUOTES),'550','300','60','20',array('pagebreak','readmore'));
    ?>
  </td>
</tr>


  </tbody>
 </table>

<input type="hidden" value="<?php echo $this->lpsettingdata->id; ?>" name="jform[id]" />


<input type="hidden" name="task" value="" />
<input type="hidden" name="controller" value="jtaglegalpages" />

</form>


Please let me know how to give id to the editor.
4

0 回答 0