You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#108760 Replace textarea in a form with JCE pro

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Ryan on Friday, 24 September 2021 16:37 BST

FL-NWR
I would like to use the JCE pro in a form to replace the textarea.

Any idea how to do that?

Ryan
I would suggest either using the Editor Field to create the textarea and initialise the editor, or the standard Joomla API call, eg:

$editor = JFactory::getConfig()->get('editor');

$instance = JEditor::getInstance($editor);
$instance->display('my_content', $content, 500, '100%', 20, 20);

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

FL-NWR
Ryan,

thanks for your suggestion but as a kind of novice without extensive knowledge in php I need some more details on where in the php or html to place this code.

In my scenario the visitor of our website opens a page with a form. The form contains a textarea and I want this textarea to be replaced with the editor so the client can add formatted text and paste screenshots.

My html looks like this:
<textarea cols="80" rows="12" name="memo" id="txa01" style="width: auto"></textarea>

Ryan
In my scenario the visitor of our website opens a page with a form. The form contains a textarea and I want this textarea to be replaced with the editor so the client can add formatted text and paste screenshots.


How are you creating the form? Is it form HTML added directly to an article?

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

FL-NWR
Yes it is within an article. I have some php in {source} tags and html

Ryan
I've created a Joomla plugin to facilitate this - https://github.com/widgetfactory/wf-editor-from-textarea Once installed and enabled, set the Editor Selector in the plugin parameters as a class value that is assigned to the textarea, eg: for the textarea below, the Editor Selector will be custom-editor.

<textarea cols="80" rows="12" name="memo" id="txa01" style="width: auto" class="custom-editor"></textarea>
When the page loads, the textarea will be converted into the default or user assigned Joomla Editor, ie: Tinymce or JCE.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

FL-NWR
Thanks a lot for the plugin. Unfortunately I cannot get it working. I installed the plugin:



I activated it:





and I changed my code:

<tr>
<td>Memo:</td>
<td colspan="3" ><textarea cols="80" rows="12" name="memo" id="txa1" style="width: auto" class="wysiwyg-editor"></textarea></td>
</tr>

But the result is still a standard <textarea>

What am I doing wrong?

Attachments

Ryan
Is this textarea created for all users or only logged in users?

Is JCE assigned as the default editor in the Joomla Global Configuration?

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

FL-NWR
I do have JCE selected in System - Configuration - Standard Editor.
The <textarea> is used for logged in and not logged in users.

Ryan
Please send me a login - https://www.joomlacontenteditor.net/contact/site-login

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Ryan
This was just an issue with plugin ordering. The Editor from Textarea plugin needed to be ordered after the Sourcerer plugin, so that the content was generated first, before the Editor from Textarea was activated.

It is fixed and appears to be working OK on your site.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

FL-NWR
Good morning Ryan,

it works fine when being logged in as admin-user. But unfortunately it does not work when being logged in as normal user. I have created another username for you, so you can check.

Thanks
Florian

Ryan
it works fine when being logged in as admin-user. But unfortunately it does not work when being logged in as normal user.


You need an editor profile that is assigned to this user group. The only editor profile that you currently have assigned to a usergroup is assigned to the Super User, which is why you don't see an editor loaded for a "normal user".

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.