Skip to main content
updated code
Source Link
user1616338
  • 407
  • 2
  • 10

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.

edit

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'];

exit;

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.

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'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.

edit

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'];

exit;

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.

Source Link
user1616338
  • 407
  • 2
  • 10

Setting Joomla input

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.