Step 2:
-Download this
(Right click : save target as ff_XHConn.js)
-Open it and change the class name to ff_XHConn
-Place it in your template folder (in my case it's located in :\templates\siteground-j15-186)
-Then edit the file index.php of your template and add betwenn <head> and </head> this line :
Step 3:
Create a PHP file and place it into a new folder that you created in joomla's folder
As for me, I created a folder named "hierselect" and a file named "requetes.php" (You will see it appear on the code of the step4 like this : /hierselect/requetes.php)
The PHP code that works for me is the following :
<?php
$field1=$_GET['field1']; //CHANGE FIELD 1 TO THE VALUE OF YOUR 1ST FIELD
mysql_connect("127.0.0.1","root",""); //ADAPT TO YOUR SERVER
mysql_select_db("PAT"); //CHANGE "PAT" TO THE NAME OF YOUR DATABASE
$lien2='Select * from TabMais6 where col1=\''.$field1.'\'' ; //CHANGE TO YOUR REQUEST
$image2=mysql_query($lien2) or die (mysql_error());
while($uneligne2=mysql_fetch_assoc($image2))
{
$test2 .= "<option value=\"{$uneligne2['id']}\">{$uneligne2['col2']}</option>\n";
//IN THE PREVIOUS LINE CHANGE id AND col2 TO ATTRIBUTES OF YOUR DATABASE
}
echo $test2;
?>
Just change what's said in the code above
Step 4 Adapt the following actionscript piece of code to your case.
Change field1 to the name of your first list
Change field2 to the name of your second list
Change "/hierselect/requetes.php" to the name of the folder and file you created in step 3
function ff_field1_action(element, action)
{
var myConn = new ff_XHConn();
if (!myConn) {alert("XMLHTTP not available. Try a newer/better browser.");}
var fnWhenDone = function (oXML)
{
ff_getElementByName('field2').innerHTML = oXML.responseText;
ff_getElementByName('field2').disabled=false;
};
ff_getElementByName('field2').disabled=true;
ff_getElementByName('field2').value = '';
myConn.connect("/hierselect/requetes.php", "GET", "field1="+ff_getElementByName('field1').value, fnWhenDone);
}
Place this code in the your first field (not in the 2nd!) there :
=>advanced tab=> section "Active Script"(or something like that)=> click "custom"=> click "change"=> place the code=>save !
I can't seem to get this code working. the first drop down populates correctly but the second seems to be turned off, the label is there but no drop down.
I've been able to get as far as loading select field values via php but I'm stuck on how to change the values. In particular the advice is to change the class name. Where is this done? I think I have everything else working fine. Any help would be immensley appreciated! Thanks.
We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.
How to receive the discount:
Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!