mardi 13 décembre 2016

Schema describes boolean, string found instead when I create list through Mailchimp API

I'm new at developing Mailchimp application. and I'm trying to create list through Mailchimp API. anyone has same issue with this error?

Here is my HTML code for checkbox input:

<input id="email_type_option" type="checkbox" name="email_type_option" value="true">
<input id="email_type_optionHidden" type="hidden" name="email_type_option" value="false">

and here is the script to save function: I used this conditional:

if (document.getElementById('email_type_option').checked) {
document.getElementById('email_type_optionHidden').disabled = true;
} else if(document.getElementById('email_type_option')) {
document.getElementById('email_type_optionHidden').disabled = false;
}

and the response from API is:

"{"type":"http://ift.tt/2hts7FF","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"","errors":[{"field":"email_type_option","message":"Schema describes boolean, string found instead"}]}"

I tried to put boolean value at my checkbox input but it always return to that error.

if I console.log this on browser it shows right to boolean value but I don't know why still got that error when I send it.

I want to make this value return into boolean not a string like the error says. How to fix it?




Aucun commentaire:

Enregistrer un commentaire