Editor Not Updating MySQL DB
Editor Not Updating MySQL DB
https://debug.datatables.net/ajeqil
I can't figure this one out. In Editor, I have this field:
{
label: "Volume:",
name: "VOLUMES[].id",
type: "select",
placeholder: "Select The Volume"
},
The call looks like this:
->join(
Mjoin::inst( 'VOLUMES' )
->link( 'SERVERS.id', 'VOL_SERVER.server_id' )
->link( 'VOLUMES.id', 'VOL_SERVER.vol_id' )
->fields(
Field::inst( 'id' )
->options( Options::inst()
->table( 'VOLUMES' )
->value( 'id' )
->label( 'name' )
),
Field::inst( 'name' )
)
)
It displays fine in the DataTables view. In the Editor view, if the field is already populated, it displays properly. However, if you make a change, nothing actually gets updated.
I've done this same type of thing in other tables without issue. I feel like I'm missing something very obvious. thanks!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Could you add the
->debug( true )
option into your Editor PHP initialisation (just before the->process()
method call would be fine) and then show me what the JSON that is being returned from the server is when you make an edit?Thanks,
Allan
Here is the JSON (obviously more thorough than the above when including the full request):
Thank you! Next question (sorry about this, I should have thought to ask it initially) - can you send me the data that is being sent to the server please? If you click on the "Headers" section of the request in the network inspector for the submit Ajax request, it should show it there.
The debug trace there shows that there isn't any write happening to the
VOL_SERVER
table, which it looks like there should be happening. So we move on to why that isn't happening!Thanks,
Allan
Oh - actually one thing. The debug trace shows you are using Editor 1.6.0. Could you update to 1.6.5 (the current release) please? Both on the client-side and the server-side. I've got a feeling this was an issue in 1.6.0 or 1.6.1.
Thanks,
Allan
Sure thing. In reverse order...I did upgrade to 1.6.5 (but for some reason debugger is still showing 1.6.0, so I assume there is a specific file that didn't get overwritten)
https://debug.datatables.net/aruzoy
the headers (sanitized sensitive data):
Got it - add
multiple: true
into yourselect
field's configuration.Without it is just submitting a single value as a string. You need it to be submitted as an array if it is going to an Mjoin.
Allan
That was it. Thank you!