I'm using

$jinput = JFactory::getApplication()->input;

to get an array of the input from a page.

I then use:

$foo = $jinput->get('jform', '', 'raw');

I can then echo $foo['formFieldName'] which prints out the correct value

I then want to change the value to something else

 $foo['formFieldName'] = "newValue";

But when I get the array again it doesn't change the value.

I'm guessing that there is some sort of setter that needs to be used but I can't get anything to work. Can anyone point me to an example that might work.


I should have put full code. I did put the value back into the original array:

$jinput = JFactory::getApplication()->input;

$foo = $jinput->get('jform', '', 'raw');

echo $foo['formFieldName'];

$foo['formFieldName'] = "newValue";

$foo = $jinput->set('jform', $foo);

$jinput = JFactory::getApplication()->input;

$foo['formFieldName'] = "newValue";

echo "<br>revised foo ".$foo['formFieldName'];


This does show the change in name but after this the system still seems to put in the previous value - like it's held by a global variable or similar.

I'm guessing that it's how I've put it into the code sequence.

  • Are you abandoning your prior question? This feels like a diplicate of that one. Jun 2, 2019 at 13:24
  • no this is a separate thing i'm trying to do - I'd still like to solve the other question if anyone is able to help. Jun 2, 2019 at 13:26
  • You are setting the value in the forked array. So if you use the get method again, it will return the original value. Try using JInput 'set'
    – Lodder
    Jun 2, 2019 at 15:28
  • @user don't you mean to read and echo the newly updated $jinput data? Jun 3, 2019 at 4:27

1 Answer 1


Use input's set() method to set input values.

$input = JFactory::getApplication()->input;
$foo = $input->get('jform', array(), 'array');
$foo['formFieldName'] = 'newValue';
$input->set('jform', $foo);

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.