You need to sign in to do that
Don't have an account?
renanfamous
Live Agent Pre-chat API not working with Checkbox
Hello there, i'm having some troubles with the Live Agent Pre-chat API (liveagent.prechat), i need a <input type="checkbox" populate a custom checkbox field, i declared everything and the values goes correctly when i submit the pre-form, but if the checkbox is checked, it does not create a case.
Here's my pre-chat screen. (It's not the final ok? haha)
i insert all i need.
The information goes right on the field (NF de equipamento on) NF de equipamento is the custom field i created and on is the result.
My pre-chat code is like this
Well, sorry for the long post, i just wanned to be very specific.
Any ideas?
Thnks a lot
Here's my pre-chat screen. (It's not the final ok? haha)
i insert all i need.
The information goes right on the field (NF de equipamento on) NF de equipamento is the custom field i created and on is the result.
My pre-chat code is like this
<!-- Formulário --> <form method='post' id='prechatForm'> <h3>{!$Label.LA_008}</h3> <!-- Nome --> <input name='liveagent.prechat:Nome' id='Nome_' placeholder="{!$Label.LA_001}" required="true" /> <!-- Sobrenome --> <input type="text" name='liveagent.prechat:Sobrenome' id="Sobrenome_" placeholder="{!$Label.LA_002}" required='true'/> <!-- Empresa --> <input type="text" name='liveagent.prechat:Empresa' id="Empresa_" placeholder="{!$Label.LA_003}"/> <!-- Tipo do chat --> <select onchange="setType(this.value)" id="tipo_Chat"> <option>{!$Label.LA_015}</option> <option value="{!$Label.LA_016}">{!$Label.LA_016}</option> <option value="{!$Label.LA_017}">{!$Label.LA_017}</option> <option value="{!$Label.LA_018}">{!$Label.LA_018}</option> <option value="{!$Label.LA_019}">{!$Label.LA_019}</option> </select> <script type="text/javascript"> function setType(a) { console.log(a); document.getElementById("tipoChat").value = a; console.log(document.getElementById("tipoChat").value); } </script> <!-- Número do chamado --> <input type="text" name='liveagent.prechat:Número do chamado' id='numeroCaso' placeholder="{!$Label.LA_009}"/> <!-- Assunto --> <input type="text" name='liveagent.prechat:Assunto' id='Assunto_' placeholder="{!$Label.LA_010}" required="true"/> <!-- Checkbox NF Equipamento --> <input type="checkbox" name="liveagent.prechat:NF de Equipamento" id="NF_check" onclick="var input = document.getElementById('NFnumber'); if(this.checked){ input.disabled = false; input.focus();}else{input.disabled=true;}"/> <label for="NF_check">{!$Label.LA_011}</label> <!-- Número da nota --> <input required="true" type="text" disabled="true" name='liveagent.prechat:Número da nota' id="NFnumber" placeholder="Número da nota"/> <!-- Botão: Iniciar Chat --> <input type='submit' value="{!$Label.LA_012}" id='prechat_submit' onclick="setName()"/> <!-- Define o nome do contato com base nos dados informados --> <script type="text/javascript"> function setName() { document.getElementById("prechat_field_name").value = document.getElementById("Nome_").value + " " + document.getElementById("Sobrenome_").value; } </script>I declared the checkbox to map the API into the field
<input type="hidden" name="liveagent.prechat.findorcreate.map:Case" value="Subject,Assunto;Status,Status;Origin,Origem do chamado;CaseNumber,Número do chamado;Tipo_chat__c,Tipo de chat;RecordTypeId,CaseRecordType;NF_equipamento__c,NF de Equipamento;Numero_NF__c,Número da nota" />And declare the field as true
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Case" value="Subject,true;Status,true;Origin,true;RecordTypeId,true;CaseNumber,true;Tipo_chat__c,true;NF_equipamento__c,true;Numero_NF__c,true" />I tried to build a JavaScript to send the value to the field like this
function NFequip () { if (document.getElementById("NF_check").checked) { document.getElementById("NFequip").value = true; } else { document.getElementById("NFequip").value = false; }Where NFequip was a input hidden with the liveagent.prechat api. With this i was able to send a boolean code to the field, but the same way, didn't work, i tried to change the boolean values to: "true", 'true', on, "on", 'on', 1, "1", '1', and none worked.
Well, sorry for the long post, i just wanned to be very specific.
Any ideas?
Thnks a lot