@frederickd, I think your issue is a PHP one, not a JavaScript one - what gets sent back to the server is an array of selected items. When using PHP, you must append square brackets to the end of the form field name. This is the same as when posting any data to a PHP backend.
Try naming your field data[repairorder][services][]
Thanks for the tip. Gotta love square brackets. In this case it didn't work for me. I added the trailing [] to the hiddenName field and the existing value in the field did not display nor would the new values save.
When I manually edit the record using an SQL tool to put comma-delimited values in, the display shows the selections (yeah!) but saves only the last one in the list.
I will see if I can assemble the array on the PHP side. The POST is obviously sending the elements. Hmmm...
@frederickd, I'm travelling in Europe at the moment and am limited to my iPhone. I'll take another look in a few days when I'm back at home and will see if I can help further - please bear with me.
I stumbled over this bug again in the current version, now it's in line 1423.
Without the patch a valuesquery isn't performed when the value is shorter than the minChars property.
I stumbled over this bug again in the current version, now it's in line 1423.
Without the patch a valuesquery isn't performed when the value is shorter than the minChars property.
Abraxxa,
Testing q like that isn't advised as a store item with a value of 0 (zero) will fail to query.
I'll consider it a bug if you can you please post a testcase and describe the problems you are having. Show me some code and some data with an explanation - thanks.
Thank you for taking a look at it. I will try to figure something out. The POST in FireBug from the JavaScript side shows the array elements. Dumping the fields on the PHP side after receiving the data yields only the last element. The previous ones are stripped for some reason.
I was experimenting with the statement v = v.toString(); to remove the array. However, I do not know how to load the variable into the original field before sending it along for the POST.
Thank you for taking a look at it. I will try to figure something out. The POST in FireBug from the JavaScript side shows the array elements. Dumping the fields on the PHP side after receiving the data yields only the last element. The previous ones are stripped for some reason.
I was experimenting with the statement v = v.toString(); to remove the array. However, I do not know how to load the variable into the original field before sending it along for the POST.
Do you think that is a viable approach? Thanks!
It sounds too much like a workaround without addressing the problem - I'd always try to understand and resolve the real issue.
Firstly, what does a screendump from the Firebug net panel look like showing the post data?
Secondly, what does a dump of the $_POST data look like when it arrives on the server?
This is with the configuration option of hiddenName: 'data[Repairorder][services]'. Like this I have noticed that I can start entering characters in a little text box and the list of elements matching appear for selection, which is great. When I have the configuration option of hiddenName: 'data[Repairorder][services][]' that feature no longer works, but the blank array entry from the FireBug POST data is gone.
I do not know why all the array elements would not be passed back to the server. I did notice that on the 2.x extensions forum for SuperBoxSelect someone else had a similar problem and solved it by having the JSON data show [Repairorder][services][]. So maybe it is because the JSON data is coming down as a text field, but trying to go back as an array.
Maybe instead of a "workaround" a configuration option could be added like returnType with a default of 'array' but an option of 'text'.