Hello All, i m using tinymce editor on joomla component that behave strangly
tinymce is already present (automaticaaly) on page load ..now if i write something on tiny mce editor( eg: 'with tinymce
') & then click on toggle editor
button ( now simple text area appears) and i see <p>with tinymce</p>,
now if i append some text (eg:'with tinymce but this time toggled
') and click on submit button then i get only this string 'with tinymce
' in post array, not the complete string 'with tinymce but this time toggled
' .
means if i write something when tinymce present on page (let 'x' ) then toggle the editor now only text area appears) and edit X (let 'x+Y') and click on submit then i get only that string which has been written when tiny mce was present on page( means i get only 'x', not 'x+Y')
please tell me what i have to write in below code to get the complete string either it wriiten with tinymce or without tinymce
my code is given below
jQuery(document).ready(function(){
jQuery("#add_cat").click(function() {
if(jQuery("#description_parent").is(":hidden")==false){ // if editor is shown then
var content = tinyMCE.activeEditor.getContent(); // get the content
jQuery("#cat_description").val(content); // put it in the textarea
}
});
jQuery("#addCategoryForm").validate({
rules: {
category_name: {
required: true,
minlength: 2
},
cat_description: "required"
},
messages: {
category_name: {
required: "Please write category name",
minlength: "category name must consist of at least 2 characters"
},
cat_description:"Please write description"
}
});
});
</script>
<form action="" method="post" name="addCategoryForm" id="addCategoryForm" >
<table >
<tr>
<th >Category Name :</th>
<td ><input type="text" name="category_name" id="category_name" size="50"></td>
</tr>
<tr>
<th valign="top"><span class="mandatory">*</span>Description :</th>
<td >
<?php
$editor =& JFactory::getEditor();
$params = array('smilies'=> '0' ,'style' => '0' ,'layer' => '0' ,'table' => '0' ,'clear_entities'=>'0');
$value = isset($this->data['description']) ? $this->data['description'] : '';
echo $editor->display('cat_description', $value,'400','300','20','20',false, $params);
?>
</td>
</tr>
<tr><td colspan="2"><input type="submit" name="add_cat" id="add_cat" ></td>
</table>
<input type='hidden' value='com_advertise' name='option' />
<input type='hidden' value='advertise' name='controller' />
<input type='hidden' value='modifyCategory' name='task' />
<input type="hidden" value='<?php echo $this->imageid; ?>' name="image_id" />
<input type='hidden' value='<?php echo $this->categoryid; ?>' name='category_id' />
<input type="hidden" name="<?php echo JUtility::getToken(); ?>" value="1" />
</form>