Am running a headless WordPress site, and have the same REST API submit problems listed above; have been unable to successfully send forms in the last month or so.
Last good version of CF7 for REST API form submittal: 5.8.5
Have followed the advice in this thread and spent many hours back and forth between the WordPress side & the form data on the front end to try to match the payload which works on the WordPress side.
This is the form submit from Vite dev server, which appears to match the payload from the WordPress embedded form page:
Payload: FormData {
[Symbol(state)]: [
{ name: 'your-email', value: '[email protected]' },
{ name: 'newsletter', value: 'SUBSCRIBE' },
{ name: '_wpcf7', value: '2039' },
{ name: '_wpcf7_version', value: '5.9.2' },
{ name: '_wpcf7_container_post', value: '3653' },
{ name: '_wpcf7_posted_data_hash', value: '' },
{ name: '_wpcf7_locale', value: 'en_US' },
{ name: '_wpcf7_unit_tag', value: 'wpcf7-f2039-p3653-o1' }
]
}
MLX Form Success: {
id: '1qyk770',
valid: true,
posted: true,
errors: {},
data: {
email: '[email protected]',
newsletter: 'on',
_wpcf7_unit_tag: undefined,
_wpcf7: undefined,
_wpcf7_version: undefined,
_wpcf7_locale: undefined,
_wpcf7_container_post: undefined,
response: 200
},
constraints: {
email: { required: true },
newsletter: { required: true },
_wpcf7_unit_tag: { required: true },
_wpcf7: { required: true },
_wpcf7_version: { required: true },
_wpcf7_locale: { required: true },
_wpcf7_container_post: { required: true }
}
}
The same payload to the same endpoint in Postman gives a unit tag error, although that is the unit tag from the WordPress version of the form page which works:
{"code":"wpcf7_unit_tag_not_found","message":"There is no valid unit tag.","data":{"status":400}}
It appears that in order to protect against SPAM, it is no longer possible to submit from React/Vue/SvelteKit frontend?
Any insight anyone has would be greatly appreciated. Would prefer not to stick at the older version, but it does still work.
All the best,
Morgan
??
-
This reply was modified 8 months, 1 week ago by trulycool. Reason: form submitted before done writing