JRequest::get('post', JREQUEST_ALLOWRAW) has been deprecated, what is the working code now?

Stella: 6 days ago

I have tried every input to get it working, but nothing works for me.

This is the deprecated code

    $post = JRequest::get('post', JREQUEST_ALLOWRAW);

    list($title, $alias) = $this->_generateNewTitle($post['catid'], $post['alias'], $post['name']);
    $_POST['name']  = $title;
    $_POST['alias'] = $alias;
    $_POST['catid'] = 0;


I tried:

$post       = JFactory::getApplication()->input->get('post', '','raw');

But sadly it doesn't work.

Ariana: 6 days ago

You are doing a small mistake here. Have a look below:

What you tried: $post = JFactory::getApplication()->input->get('post', '','raw');

  • Here, 'post' must be the name parameter of the input field of which you want to fetch the value. Example below:

$post = JFactory::getApplication()->input->post->get('name', '','raw'); Output: will give you the value of name input field.

In your case, you want to fetch the value of the entire post data in variable $post so you should try this:

$post = JFactory::getApplication()->input->post->get('jform','','raw');

jform - I assume you are using joomla forms so by default the input field will come like jform[name], jform[catid],etc

Let us know on this