“wpcf7_unit_tag_not_found”, “There is no valid unit tag.”
Hello friends
I am using Nuxt as front-end, WordPress as back-end for CMS purpose. In front-end, I create a form-data below:
……
some code
….
body.append(“_wpcf7”, “20”);
body.append(“_wpcf7_version”, “5.9.8”);
body.append(“_wpcf7_unit_tag”, “wpcf7-f20-o1”);
My problem is that I receive the code “wpcf7_unit_tag_not_found” and message “There is no valid unit tag.” I check my form id and it is correct. I check my syntax and it is correct as well. However when I try out with Postman, magically, it works. Then I try out on WordPress theme, it works. I know it works because I receive the auto response email. The saddest things is it does not work when I use POST API call on Nuxt.
More detail about my code :
this is my custom composable for fetching data purpose
import { useFetch } from "#app";
import { useRuntimeConfig } from "#app";
export default async function useContactFormAPI(body) {
const runtimeConfig = useRuntimeConfig();
const { data, error } = await useFetch(runtimeConfig.public.CONTACT_FORM_API, {
method: "POST",
headers: {
"Content-Type":
multipart/form-data; charset=utf-8; boundary= + ${Math.random().toString()}
,
},
body: body,
});
console.log(error);
return data.value;
}
this is my event handler
const handleClick = async (event) =>{
const body = new FormData();
....
some data
....
body.append(“_wpcf7”, “20”);
body.append(“_wpcf7_version”, “5.9.8”);
body.append(“_wpcf7_unit_tag”, “wpcf7-f20-o1”);
const data = await useContactFormAPI(body);
console.log(data);
console.log(event);
}
Can someone please help me out ?
Thank you so much in advance.!!!0 Replies