I have changed a few things, I have regenerated database table and email
autocompleter
<?php
foreach($form->data['Datacom'] as $uno){
if(!empty($form->data['tag']) AND stripos($uno['codiceprodotto'], $form->data['tag']) === false){
continue;
}
$json[] = array('id' => $uno['nomeprodotto'], 'text' => $uno['codiceprodotto']);
}
echo json_encode($json);
?>
javascript
jQuery(document).ready(function(jQ) {
jQ('#codice').on("select2-selecting", function(evt) {
jQ('#nome').val(evt.choice.id);
});
});
in the form I see everything correctly
in the mail and db restores my twice the product name (both in code in the name)
I would not be wrong but I think the problem lies in Autocompleter code ... there is a bit of confusion
Debug:
Data Array
Array
(
[option] => com_chronoforms5
[view] => form
[Itemid] => 127
[chronoform] => PRATICA
[event] => submit
[codiceutente] => WebMaster
[mail] => polizzano@feelplus.it
[datapratica] => 28-06-2016
[contatto] => inserire nome e/o telefono se diverso
[codice] => DH-9000 18"45
[nome] => DH-9000 18"45
[descrizionedifetto] => ygje
[manifestazionedifetto] => yytjtej
[datigaranzia] => 0
[numeroddt] => 1234.55555
[dataddt] => 14/06/2016
[datascontrino] =>
[dichiarazione] => 1
[inviopratica] => INVIA PRATICA
[mailutente] => polizzano@feelplus.it
[id] => 57
[ip_address] => xxxxxxxx
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[4] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
[0] => INSERT INTO `garanzia_pratiche` (`codiceutente`, `mail`, `datapratica`, `contatto`, `descrizionedifetto`, `manifestazionedifetto`, `datigaranzia`, `numeroddt`, `dataddt`, `datascontrino`, `dichiarazione`, `inviopratica`, `user_id`, `uniq_id`, `created`) values ('WebMaster', 'polizzano@feelplus.it', '28-06-2016', 'inserire nome e/o telefono se diverso', 'ygje', 'yytjtej', '0', '1234.55555', '14/06/2016', '', '1', 'INVIA PRATICA', '628', '9ea886d0cf259f33c1cf773a3523549383e37a8 e', '2016-06-28 16:03:36');
)
)
)
[9] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:polizzano@feelplus.it, garanzia@feelplus.it
[2] => Subject:FEELPLUS - Pratica di Assistenza
[3] => From name:FEELPLUS - Assistenza Tecnica
[4] => From email:garanzia@feelplus.it
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:
[9] => Attachments:
[10] => Array
(
)
[11] => Body:
<table border="1">
<tr><td>Codice Utente</td><td>WebMaster</td></tr>
<tr><td>E-Mail</td><td>polizzano@feelplus.it</td></tr>
<tr><td>Data Pratica</td><td>28-06-2016</td></tr>
<tr><td>Contatto</td><td>inserire nome e/o telefono se diverso</td></tr>
<tr><td>Codice Prodotto</td><td>DH-9000 18"45</td></tr>
<tr><td>Nome Prodotto</td><td>DH-9000 18"45</td></tr>
<tr><td>Descrizione Difetto</td><td>ygje</td></tr>
<tr><td>Come si è manifestato il difetto ?</td><td>yytjtej</td></tr>
<tr><td>Dati garanzia</td><td>0</td></tr>
<tr><td>N. DDT</td><td>1234.55555</td></tr>
<tr><td>Data DDT</td><td>14/06/2016</td></tr>
<tr><td>Data Scontrino</td><td></td></tr>
<tr><td>Scontrino</td><td></td></tr>
<tr><td>id</td><td>57</td></tr>
</table>[br /][br /]IP: xxxxxxx
)
)
)