I am busy with a project to convert an Joomla 3 template to Joomla 4. The Jinput is not giving me RAW data it is removing the script tags from my inputs. I worked through a couple of similar problems on the web still could not get it right.

The XML for the field is

<field name="fieldname" type="editor" default="&lt;script&gt; &lt;/script&gt;" label="Add code to the top &lt; head &gt;" description="" rows="10" cols="5" filter="raw" editor="codemirror|none"/>

The input code is

$app    = JFactory::getApplication();
$input  = $app->input;
$post   = $input->post->getArray();

I am getting the values in the following foreach loop

foreach (array_keys($post['jform']['params']) as $param) {
  $value = $post['jform']['params'][$param];

Thanks in advance

1 Answer 1


You need to specify the filter because otherwise default filter is applied. There are several ways to do it. First one is to pass the third argument to getArray():

$post = $input->post->getArray([], null, 'RAW');

This isn't recommended because Joomla\CMS\Input\Input is deprecated and getArray() method in replacement Joomla\Input\Input class does not have a third argument.

Another way is to specify data/filter pairs:

$post = $input->post->getArray(['jform' => 'ARRAY', 'task' => 'CMD']);

This method also allows defining nested fields/filters within data arrays:

$post = $input->post->getArray(['jform' => ['title' => 'STRING', 'articletext' => 'RAW']]);

If you need just a single top level data array like jform, simplest way is to use get() method instead:

$post = $input->post->get('jform', [], 'ARRAY');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.