Using editor to upload multiple records (approx 10), not saving, no errors
Using editor to upload multiple records (approx 10), not saving, no errors
Looking for a debug process as I am not sure why it's not saving.
I am testing the import / upload csv with a small file and had it working with a generic table. then I retooled it with a different table / server side php file and everything appears to be working but it's not saving any records. I have the debug set in the PHP and I do not see any errors. I am also writing out the $_POST data the PHP receives and I see all the data. dev mode does not show any errors returned from the PHP.
I am wondering what else I should look at to debug/determine why it's not saving?
Below is the $_POST from my server side PHP utilizing editor:
{"data":[{"VotingAID":"","VotedAddedDT":"","UserAID":"","CacheAID":"","VoteInactive":"","VoteInactiveCacheAID":"","LivesInPrecinct":"CITY OF xx 09-05","Name":"","LastName":"test1","FirstName":"test1f","MiddleName":"A","Suffix":"","VotedAtPollPrecinct":"","BallotStyle":"","BallotType":"Regular","VoterID":"X014754","ResidentAID":"","MatchNotes":"","AutoMatched":"","ManMatched":"","ManMatchedUserAID":"","ManMatchedDT":""},{"VotingAID":"","VotedAddedDT":"","UserAID":"","CacheAID":"","VoteInactive":"","VoteInactiveCacheAID":"","LivesInPrecinct":"CITY OF xx 13-02","Name":"","LastName":"test2","FirstName":"test2f","MiddleName":"","Suffix":"","VotedAtPollPrecinct":"","BallotStyle":"","BallotType":"Regular","VoterID":"M035631","ResidentAID":"","MatchNotes":"","AutoMatched":"","ManMatched":"","ManMatchedUserAID":"","ManMatchedDT":""}],"action":"create"}
This question has an accepted answers - jump to answer
Answers
That's the data being submitted to the server? I'd expect it to look more like this, as HTTP parameters:
Even if you were to JSON stringify it (using
ajax.submitAs, which I [suggested in your other recent thread]((https://datatables.net/forums/discussion/81477/), the structure of the data wouldn't look like what you've posted, as there is no primary key slot at the top level of thedataobject.What you've posted looks like the data used to load into a DataTable, except for the
action: 'create'which is very much a submit data point. So I'm not 100% sure what I'm looking at here!If you could post a link to a test case showing the issue that would greatly help.
Allan
Thank you, This should work
https://jyorkejudge.org/votingupload_testo.php
Below are the contents of a test file to upload:
EnterDate,VoterID,Lastname,Firstname,MiddleName,Suffix,LivesInPrecinct,ballottype,Party,JurisdictionType,Jurisdiction
10/25/25 9:02,X014754,test1,test1f,A,,CITY OF xx 09-05,Regular,DEM,xx,01
10/25/25 9:05,M035631,test2,test2f,,,CITY OF xx 13-02,Regular,BLK,xx,01
Thank you. Can you show me the contents of
votingupload_testo.phpas well please?Thanks,
Allan
Thank you.
Do you see the messages from lines 15 and 33 being logged out?
Allan
fyi, I had to change the underlying table in my php as I needed to make some changes on the backend, the table is now voting_o
I added the line # to the call to log_message on lines 15 and 39 to verify what I see in the logs are coming from those to lines. I do see the entries in my log (see below)
I also added a call to log_message under
and I don't see it in my log files.
2025-10-28 11:28:40 [47] [DEBUG] [/php/votingupload_testo.php] $_POST from line 15= {"data":[{"VotingAID":"","VotedAddedDT":"","UserAID":"","CacheAID":"","VoteInactive":"","VoteInactiveCacheAID":"","LivesInPrecinct":"CITY OF xx 09-05","Name":"","LastName":"test1","FirstName":"test1f","MiddleName":"A","Suffix":"","VotedAtPollPrecinct":"","BallotStyle":"","BallotType":"Regular","VoterID":"X014754","ResidentAID":"","MatchNotes":"","AutoMatched":"","ManMatched":"","ManMatchedUserAID":"","ManMatchedDT":""},{"VotingAID":"","VotedAddedDT":"","UserAID":"","CacheAID":"","VoteInactive":"","VoteInactiveCacheAID":"","LivesInPrecinct":"CITY OF xx 13-02","Name":"","LastName":"test2","FirstName":"test2f","MiddleName":"","Suffix":"","VotedAtPollPrecinct":"","BallotStyle":"","BallotType":"Regular","VoterID":"M035631","ResidentAID":"","MatchNotes":"","AutoMatched":"","ManMatched":"","ManMatchedUserAID":"","ManMatchedDT":""}],"action":"create"}
$_POST from line 15= {"data":[{"VotingAID":"","VotedAddedDT":"","UserAID":"","CacheAID":"","VoteInactive":"","VoteInactiveCacheAID":"","LivesInPrecinct":"CITY OF xx 09-05","Name":"","LastName":"test1","FirstName":"test1f","MiddleName":"A","Suffix":"","VotedAtPollPrecinct":"","BallotStyle":"","BallotType":"Regular","VoterID":"X014754","ResidentAID":"","MatchNotes":"","AutoMatched":"","ManMatched":"","ManMatchedUserAID":"","ManMatchedDT":""},{"VotingAID":"","VotedAddedDT":"","UserAID":"","CacheAID":"","VoteInactive":"","VoteInactiveCacheAID":"","LivesInPrecinct":"CITY OF xx 13-02","Name":"","LastName":"test2","FirstName":"test2f","MiddleName":"","Suffix":"","VotedAtPollPrecinct":"","BallotStyle":"","BallotType":"Regular","VoterID":"M035631","ResidentAID":"","MatchNotes":"","AutoMatched":"","ManMatched":"","ManMatchedUserAID":"","ManMatchedDT":""}],"action":"create"}
2025-10-28 11:28:40 [47] [DEBUG] [/php/votingupload_testo.php] _POST['action'] from line 39=create
Oh! Your
Fieldinstances all use a table prefix -e.g:Voting.UserAID, but the data from the clientside doesn't:"UserAID".You need the
field.nameconfiguration on the client-side to match the server-side field names.Allan
I feel silly, thank you!