Hello,
i am looking for an unique contact form.
The dropdown value gives an id. This id is the id of the contact( name address, mail, ...) in the com_contact table.
I try to display contact informations (address tel, etc, ...) depending the dropdown selected option in a container . I try to use ajax for that.
On designer/events, i creat a new event "function call" on (change value) of (dropdown1) function (getcontact()).
On setup, on load, i have a load js with
I get the alert cid so it seems success.
I have created an event called ajax, with a db reader inside with condition
Inside the ajax event i have a custom code
I must have forgot some points.
How set the dropdown value in the ajax call?
How can i display value of the results?
Regards
i am looking for an unique contact form.
The dropdown value gives an id. This id is the id of the contact( name address, mail, ...) in the com_contact table.
I try to display contact informations (address tel, etc, ...) depending the dropdown selected option in a container . I try to use ajax for that.
On designer/events, i creat a new event "function call" on (change value) of (dropdown1) function (getcontact()).
On setup, on load, i have a load js with
function getcontact()
{
var cid = document.getElementById("dropdown1").value;
jQuery.ajax({
url: 'mydomaine.com/index.php?option=com_chronoforms5&chronoform=general-contact&event=ajax',
method: 'get',
success : function(data){
document.getElementById('chronoform-container-5').innerHTML = $("results");
/* alert('cid');*/
},
error : function(data){ alert('error');}
});
};
I get the alert cid so it seems success.
I have created an event called ajax, with a db reader inside with condition
<?php
return array('id' =>$form->data['dropdown1'] );
?>
Inside the ajax event i have a custom code
<div id="coord" style="">
<?php
foreach ($form->data['contact2'] as $vals) {
$result= "<div id=coord".$vals['id'].">".$vals['name'] . " : ".$vals['address'] . "</div>";echo $result;}
$results= json_encode($result);
?>
</div>
I must have forgot some points.
How set the dropdown value in the ajax call?
How can i display value of the results?
Regards