Hello,
I have a problem.
I'm using Chrnoform V4 with Joomla 2.5 for the dropdpwn nested (country,town)
The code is this :
The user fills the first dropdown but the firebug write that New Ajax is not defined.
Where's the error code? or joomla should be have some plug in
Thanks you
I have a problem.
I'm using Chrnoform V4 with Joomla 2.5 for the dropdpwn nested (country,town)
The code is this :
view source
print?
<script type="text/javascript">
var id_select_to_write = "";//variabile globale della select html da scrivere
function PopolaProvince() {
if (document.getElementById("select_regioni").value == "00"){
alert ("Attenzione: Devi selezionare una regione.")
SvuotaSelect('select_comuni');
SvuotaSelect('select_province');
return;
}
document.getElementById("attesa").innerHTML = ' Attendere....';
CosaFare = "PopolaProvince";
SvuotaSelect('select_comuni');
SvuotaSelect('select_province');
id_select_to_write = "select_province";
var id = document.getElementById("select_regioni").value;
var url = "index2.php?option=com_chronocontact&chronoformname=form_ajax&Funzione="+CosaFare+"&id="+id;
new Ajax(url, {
method: 'get',
onComplete: parseResult
}).request();
}
function PopolaComuni() {
document.getElementById("attesa").innerHTML = ' Attendere....';
CosaFare = "PopolaComuni";
id_select_to_write = "select_comuni";
var id = document.getElementById("select_province").value;
var url = "index2.php?option=com_chronocontact&chronoformname=form_ajax&Funzione="+CosaFare+"&id="+id;
new Ajax(url, {
method: 'get',
onComplete: parseResult
}).request();
}
function parseResult(request)
{
var msg = request.split('##@##');
document.getElementById("attesa").innerHTML = "";
document.getElementById(id_select_to_write).innerHTML=msg[1];
if(document.all)
{
ie = "<option>opzione</option>" + msg[1];
document.getElementById(id_select_to_write).innerHTML=ie;
document.getElementById(id_select_to_write).outerHTML = document.getElementById(id_select_to_write).outerHTML;
}else{
document.getElementById(id_select_to_write).innerHTML=msg[1];
}
if (CosaFare == "PopolaProvince"){
PopolaComuni();
}
}
function SvuotaSelect(id_select){
num_option=document.getElementById(id_select).options.length;
for(a=num_option;a>=0;a--){
document.getElementById(id_select).options[a]=null;
}
}
</script>
<p><div id="attesa"> </div></p>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Regione</label>
<select onchange="PopolaProvince()" id="select_regioni" size="1" name="select_regioni">
<option value="00">Seleziona una regione...</option>
<?php
$database = &JFactory::getDBO();
$sql = "SELECT * FROM #__regioni";
$database->setQuery($sql);
$results = $database->loadAssocList();
for($i=0, $ct=count($results); $i < $ct; $i++) {
echo "<option value=".$results[$i]['id'].">".$results[$i]['name']."</option> <br />";
}
?>
</select>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Provincia</label>
<select class="cf_inputbox" id="select_province" size="1" title="" name="select_province" onchange="PopolaComuni()">
</select>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Comune</label>
<select class="cf_inputbox" id="select_comuni" size="1" title="" name="select_comuni">
</select>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textarea">
<label class="cf_label" style="width: 150px;">Messaggio</label>
<textarea class="cf_inputbox" rows="2" id="text_3" title="" cols="30" name="text_messaggio" ></textarea>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_button">
<input value="Invia Messaggio" name="button_4" type="submit" />
</div>
<div class="cfclear"> </div>
</div>
The user fills the first dropdown but the firebug write that New Ajax is not defined.
Where's the error code? or joomla should be have some plug in
Thanks you