You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there! I am submitting a Guest Entry form via axios, and am receiving the following error "Values did not pass validation.". Validate? is set to off in the plugin settings, as I'm doing my own validation via Javascript.
const inputs = selectAll(wrapper, 'input, textarea')
validateInputs(inputs, () => {
// Guest Entries plugin is expecting data in FormData format, not json
const formdata = new FormData();
inputs.forEach((element) => {
formdata.append(element.name, element.value);
});
axios.post(handler, formdata)
.then((res) => {
console.log(res);
// Show message no matter what, as reviews have to be approved by mods anyway
showMessage(true)
})
.catch(err => console.error(err))
})
})
I even tried via axios with a JSON object for the data, and I get the same validation error.
validateInputs(inputs, () => {
// Guest Entries plugin is expecting data in FormData format, not json
// const formdata = new FormData();
// inputs.forEach((element) => {
// formdata.append(element.name, element.value);
// });
let obj = inputs.reduce((acc, current) => {
acc[current.name] = current.value
return acc
}, {})
axios({
method: 'post',
url: handler,
data: obj,
config: { headers: {'Accept': 'application/json' }}
})
.then((res) => {
console.log(res);
// Show message no matter what, as reviews have to be approved by mods anyway
showMessage(true)
})
.catch(err => console.error(err))
})
The text was updated successfully, but these errors were encountered:
kblizeck
changed the title
Validate? is set to off, but still receiving validation error when submitting via axiosValidate? is set to off, but still receiving validation error when submitting via axios
Oct 7, 2019
Hi there! I am submitting a Guest Entry form via axios, and am receiving the following error
"Values did not pass validation."
.Validate?
is set to off in the plugin settings, as I'm doing my own validation via Javascript.I even tried via axios with a JSON object for the data, and I get the same validation error.
The text was updated successfully, but these errors were encountered: