Hot answers tagged

5 votes
Accepted

How to access an array in $_GET using JInput?

The first method looks for elements that start with the name that you have specified: <input type="hidden" name="nameOfArray[test][1]" value="test" /> <input type="hidden" name="nameOfArray[]...
user avatar
5 votes
Accepted

Using JInput instead of $_POST

This should work: $values = $app->input->getArray(array('data'=>'array')); echo $values['data']['server']; Please see I did not mention post variable specifically, because this can retrieve ...
user avatar
  • 2,971
4 votes

Using JInput instead of $_POST

You could try: $data = $input->post->get('data', array(), 'ARRAY'); $server = $data['server']; Haven't a playground to test this in, but I think it works.
user avatar
  • 2,295
3 votes
Accepted

How to show multidimensional data in my CanvasJS chart?

Your original coding attempt is repeatedly overwriting the $dataPoints variable inside of the loop -- this is why you only see the last iteration's data. To create the desired multidimensional array ...
user avatar
  • 4,388
3 votes

How to write a condition to check if a number is a multiple of 30?

So you are counting all submissions 1 user has and you want to display that message when the user has 30, 60, 90, ... submissions? That doesn't make much sense to me but the solution would be to ...
user avatar
  • 3,693
2 votes
Accepted

How can I output each item of a multiple list custom field

I haven't tested this so I could be wrong. But if I rightly remember, a protected object cannot be retrieved by $field->fieldparams->options. Instead, you'll need to use: $options = $field->...
user avatar
  • 26.4k
2 votes

How can I output each item of a multiple list custom field

The field options are a registry object so if you've already got the field you can grab all the options with something like: $field_options = $field->fieldparams->toArray(); print_r that and ...
user avatar
  • 3,134
2 votes
Accepted

JFactory::getApplication()->input->post->get() prunes empty sub arrays/objects

If you dumped the $_POST in your helper's ajax method you would see that those empty arrays don't hit the server. Joomla's input object is entirely dependent on retrieving the values from $_POST. ...
user avatar
  • 3,134
2 votes
Accepted

Joomla getting items via model wrong data type

It is a json encoded string. $images = json_decode($item->images);
user avatar
2 votes
Accepted

Joomla foreach AssocList - modify array

Syntax for modifying the array would be something like $db->setQuery($query); $rows =$db->loadAssocList(); foreach ($rows as &$row) // & to give a reference, not copy, to the row in ...
user avatar
  • 738
2 votes
Accepted

Show more than two values from array

Been a while since I used repeatable form fields (deprecated and subform fields should be used instead), but if I rightly remember, the repeatable form fields response format was a little different. ...
user avatar
  • 26.4k
2 votes
Accepted

Show images and caption from array as images in carousel

It's how Repeatable field stores its data. Pick a field to iterate over and use its key to access value of another field: foreach ($carousel_images['carouselimage'] as $key => $image) { // do ...
user avatar
  • 8,222
2 votes

In custom fields, array_values() prints "Array"

PHP array_values returns an array - that's why you get "array" printed out. Most likely if you deal with an array and want to make it a string, then you are after implode($separator, $array); http://...
user avatar
  • 19.5k
1 vote

Creating a multidimensional JForm field dynamicaly

I found a solution that seams to work. Creating the Form without the usual jform control class like this: // $form = $this->loadForm('my_comp.examplegroup', 'examplegroup', array('control' => '...
user avatar
  • 331
1 vote

In custom fields, array_values() prints "Array"

To construct your tag data in the format that can be echoed into the html, you must convert the data into a string. array_values() does not convert an array to a string, it reindexes (assigns new ...
user avatar
  • 4,388
1 vote

How to access user-submitted values from a dynamic form?

First, you need to repair your damaged form html // see the missing closing square bracket on each of your name attr ---↓-------------------↓-↓ ...
user avatar
  • 4,388
1 vote
Accepted

Preprocessing form data before saving to the database

I've figured it out with the help of someone on the Joomla DEV Google Groups (details): I did not have my custom field dancer_id added to the jform array like so: <input id="dancer_id" type="...
user avatar
  • 51
1 vote

Preprocessing form data before saving to the database

Have you tried retrieving the form input directly without using JFilterInput? Try this: replace: $filter = JFilterInput::getInstance(); with: $dancers = $input->get('dancer','','array'); you ...
user avatar
  • 1,737

Only top scored, non community-wiki answers of a minimum length are eligible