TOPIC:

Re: how change values to select list...? 11 years 8 months ago #32087

  • jem24h
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 15
  • Thanks: 0
I finally managed to do a hierselect thanks to rausilva's method !

Here is what I did :

Step 1:
Fill the first field. I posted a method on how to do that on this post or th that post(in french)

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 :
<script type="text/javascript" src="ff_XHConn.js"></script>


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 !

Normally, it should be working.. ;)

Hope it helps

Please Log in or Create an account to join the conversation.

Last edit: Post by jem24h.

Re: how change values to select list...? 11 years 7 months ago #35873

  • jem24h
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 15
  • Thanks: 0
It works perfectly with firefox and chrome but unfortunately doesn't work with internet explorer; even with the version 9.

Does anyone know where this can come from ?

Please Log in or Create an account to join the conversation.

Re: how change values to select list...? 11 years 5 months ago #41266

  • Phone
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 1
  • Thanks: 0
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. :(

Please Log in or Create an account to join the conversation.

Last edit: Post by Phone.

Re: how change values to select list...? 10 years 5 months ago #76188

  • lxp
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 21
  • Thanks: 0
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.

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.048 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

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!