Forums

WYSIWYG editor in front end not populated

gporterfield 06 Dec, 2008
I am trying to include the Joomla WYSIWYG editor in my front-end template to allow the edit of a mediumtext field. The editor appears, but it does not get populated with the data from the database row.

Here is my code for front-end template:
<tr><td colspan=3>
<?php 
      echo $editor->display( 'Description', '  ' , '100%', '200', '75', '20', false ) ;
?>
</td></tr>


The HTML for the displayed page looks like this:
<tr><td colspan="3">
<textarea id="Description" name="Description" cols="75" rows="20" style="width:100%; height:200px;" class="mce_editable=">  </textarea>

</td></tr>


The same code works OK in the back end as part of my Admin Config.

TIA,
George
Max_admin 07 Dec, 2008
Hi George,

edit your editor code to look like this :

<?php
      echo $editor->display( 'Description', '{Description}' , '100%', '200', '75', '20', false ) ;
?>


the admin area is using JS code to populate fields because its guaranteed that JS will work ok in admin but not in frontend!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gporterfield 10 Dec, 2008
Max or Bob:
<?php
      echo $editor->display( 'Description', '{Description}' , '100%', '200', '75', '20', false ) ;
?>
This works fine unless the data for the editor contains quote marks (single or double). If quote marks are in the data field, I get the following error:

Parse error: syntax error, unexpected T_STRING in /home/ctbc/public_html/components/com_chronoconnectivity/chronoconnectivity.html.php(283) : eval()'d code on line 49


I had a similar problem on my work around for the select field, so I modified my code for that to use the addslashes function each time I referenced the source field. But I could not figure out a way to do the same thing here. Any ideas?

George
Max_admin 10 Dec, 2008
try to replace '{Description}' with addslashes($row->Description)

let me know!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gporterfield 10 Dec, 2008
Max:

Changing to addslashes($row->Description) allowed the page and WYSIWYG editor to load. But the backslashes show up in the text in the editor. (When I used the same technique for an INPUT field, the backslashes did not show up.) Is there another php function that would work better for this requirement? (I am an experienced programmer, but not with php.) :?

George
Max_admin 12 Dec, 2008
try :

<?php
      echo $editor->display( 'Description', $row->Description , '100%', '200', '75', '20', false ) ;
?>


?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gporterfield 12 Dec, 2008
Max:

Thanks. That worked successfully.

George
This topic is locked and no more replies can be posted.