Forums

Rich text editor now available?

natloz 09 May, 2016
I have a chronoform that when adding a record to the database, my multi-line text box has rich text capabilites (bold, italic, etc...). When I create another form to reload the data record for edit, the text comes back from the data with html tags in the text and the multi-text control seems to display it in plain text.

eg.

<p>Blah blah blah</p> as it was stored in the database. How do I get it so the edit box on reload is automatically formatted in rich text editor? The WYSIWYG is enabled as YES.
GreyHead 10 May, 2016
Hi hatloz,

I can't recreate this. When I save and reload the formatting is retained. Please drag a Debugger action into the On Load event, then load the form and post the debug results here.

Bob
natloz 10 May, 2016

Array
(
    [option] => com_chronoforms5
    [chronoform] => ProblemReview
    [cf_id] => 52
    [2b79f64a5a4c8283e316ccef3651e5f7] => 1
    [problem] => Array
        (
            [cf_id] => 52
            [problemTitle] => Test problemss
            [problemDescription] => <p>This is a test problem to be used in testing.</p>
            [isApproved] => 0
            [fileUpload] => 
        )

    [user] => Array
        (
            [email] => blah@blah.com
        )
)



Array
(
    [16] => Array
        (
            [DB Read] => Array
                (
                    [Queries] => Array
                        (
                            [0] => SELECT `problem`.`cf_id` AS `problem.cf_id`, `problem`.`problemTitle` AS `problem.problemTitle`, `problem`.`problemDescription` AS `problem.problemDescription`, `problem`.`isApproved` AS `problem.isApproved`, `problem`.`fileUpload` AS `problem.fileUpload`, `user`.`email` AS `user.email` FROM `jos_cf_Problem` AS `problem` LEFT JOIN `jos_users` AS `user` ON problem.user_id = user.id WHERE `problem`.`cf_id` = '52' GROUP BY `problem`.`cf_id`
                        )

                )

        )

)


Here it is.
GreyHead 10 May, 2016
Hi hatloz,

The <p> tags have been preserved OK - what happens if you try some more complex formatting?

Bob
natloz 12 May, 2016
Sorry for the delay...I entered with more formatting a new item, and when retrieving it I simply get as you see back into the TEXT Box...nothing rich about it.


<p><strong>This is a test.</strong></p>
<ol>
<li><strong>Bullet 1</strong></li>
<li><strong>Bullet 2</strong></li>
<li><strong>Bullet 3</strong></li>
</ol>
<p><em>This is italic with a carriage return before.</em></p>


The tags are all there, just not rendering in the edit form text box.
natloz 12 May, 2016
Here is an image to show you how it looks.
GreyHead 12 May, 2016
Hi natloz,

It looks as though either the Rich Text editor isn't turned on in the editing form or there is a JavaScript error on the page that is stopping it working.

Bob
natloz 12 May, 2016
Answer
Ok, I think I may have found a bug. I had the Field ID written the same way as the Field Name as

problem[problemDescription]

.

As soon as you have the square brackets in their the field loses it rich text capability. Once I change the Field ID to

problemDescription

, the rich text capability was back. Very strange...wouldn't you say?
GreyHead 13 May, 2016
1 Likes
Hi natloz,

Square brackets - and other special characters - aren't allowed in IDs, that's the HTML rules. In this case I'd guess that that having them there stopped jQuery from correctly identifying the input to add the Rich Text Editor to.

In general use IDs like problem_problemDescription or just problemDescription

Bob
natloz 13 May, 2016
Thanks for all your help and support.
This topic is locked and no more replies can be posted.