When I saved forms before with json encoded repeater areas, they saved as null in mysql if there was no data, now they are saving as "" in the same field. This has happened since the last update - any resolution to correct this or stop this from happening as it's causing major issue with all my custom code areas with logical expressions?
Forums
Json encoding now does not save as null in mysql
This is happening to me as well. {data:field/DEFAULT IF EMPTY} doesn't work properly anymore because an empty field sends a "" value instead of nothing.
For now I've had to put in if($var ==='""'){...} else {...} instead of 'null' which is working for any custom code outputs, but still annoying! I've got abut 30 forms relying on this so quite some work to put right even if until a fix comes into play.
What type of field has this issue ? an empty "text" field will send "", but an unselected checkbox with "ghost disabled" will send null and will use the default value.
Please post a test case!
Best regards
Please post a test case!
Best regards
I might be wrong but I always though {data:field/DEFAULT} would show DEFAULT if the text field was empty.
No, only if the value is null or if not available in the data array!
Best regards
Best regards
I have a text fields and dropdown fields within a repeater set which is then saved into a single column in a mysql table json encoded on save. However if the repeater isnt used CF6 used to save the value is 'null', after the update it now saves as ""
Examples:
OLD with data - [{"aid":"2248","gid":"","conf":"y","agent_access":"","type":"H","agent_id":"110","value":"","date":""}]
OLD without data - null
NEW with data - [{"aid":"2248","gid":"","conf":"y","agent_access":"","type":"H","agent_id":"110","value":"","date":""}]
NEW without data - ""
Does that help understand or do you need the form?
Thanks
Examples:
OLD with data - [{"aid":"2248","gid":"","conf":"y","agent_access":"","type":"H","agent_id":"110","value":"","date":""}]
OLD without data - null
NEW with data - [{"aid":"2248","gid":"","conf":"y","agent_access":"","type":"H","agent_id":"110","value":"","date":""}]
NEW without data - ""
Does that help understand or do you need the form?
Thanks
Ok, how do you get this encoded value ? and what are your fields names ?
I have a repeater area , called repeater_area65, and each field setup with the syntax like:
Name :appt[{var:area_repeater65.key}][conf]
ID :
conf{var:area_repeater65.key}
And in setup tab a Save Data action with a field setup on Data override on Insert / Update like:
appointments:{data.jsonen:appt}
Name :appt[{var:area_repeater65.key}][conf]
ID :
conf{var:area_repeater65.key}
And in setup tab a Save Data action with a field setup on Data override on Insert / Update like:
appointments:{data.jsonen:appt}
For the 2 results you have printed above (New with data and New without data), what are the contents of the data array you get when you add a "debugger" to your form ?
The data array is the first array shown on the page in the debug output!
The data array is the first array shown on the page in the debug output!
On Edit:
On Save:
[appointments] => [{"aid":"2248","gid":"","conf":"y","agent_access":"","type":"H","agent_id":"110","value":"","date":""}]
On Save:
[appt] => Array ( [0] => Array ( [aid] => 2248 [gid] => [conf] => y [change_spec] => [agent_access] => [type] => H [agent_id] => 110 [value] => [date] => ) )
No, I want the data array from the debugger (the top part of the debugger) when there is data and when there is no repeater data, before any json encoding is done!
Sorry Max, I'm not 100% sure what you want to see, so I've opened the access for you here with debugger on and repeater area data deleted:
https://klippa-relo.com/client-bookings-area/find-asignee/edit-asignee?aid=306&event=load
Please let me know when you've had a look and I'll remove public access again.
https://klippa-relo.com/client-bookings-area/find-asignee/edit-asignee?aid=306&event=load
Please let me know when you've had a look and I'll remove public access again.
I get an error "column username can not be null" when I try to update the record!
I just need to check the data posted by the form when its submitted with and without the repeater.
I just need to check the data posted by the form when its submitted with and without the repeater.
Ah, it's because you aren't logged in it uses the logged in user for a field . If you revisit the page the rest of the data is saved correctly ( inc repeater area).
If not I can send you login access and setup copies for the forms for you to change / edit as you please?
If not I can send you login access and setup copies for the forms for you to change / edit as you please?
No need for a login, just test the form twice, one time with a repeater item filled in, and one time without any repeater items, and copy here the data array contents from the debug in both cases!
OK, weirdly its saving this as null at the moment, which is what I want. I have another form which I'll check for the same issue, which is where I first found the problem and if it's not saving as null I'll set up the forms as requested and reply to this thread.
I've just got a lot on today which is urgent for tomorrow, so I'll finish what I have to first and then report back later.
Thanks for your help so far Max🙂
I've just got a lot on today which is urgent for tomorrow, so I'll finish what I have to first and then report back later.
Thanks for your help so far Max🙂
This topic is locked and no more replies can be posted.