TOPIC:

Re:how change values to select list...? 13 years 5 months ago #6456

  • raulsilva's Avatar Topic Author
  • raulsilva
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 5
  • Thanks: 0
ok, let me see this code... and i'll tell you if can do work my program...

Thank you so much!!!

see ya!!

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

Re:how change values to select list...? 12 years 6 months ago #13741

  • deborahSusan's Avatar
  • deborahSusan
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 14
  • Thanks: 1
Did you get it to work?

Cheers ~ deborahSusan

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

Re:how change values to select list...? 12 years 6 months ago #13773

  • raulsilva's Avatar Topic Author
  • raulsilva
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 5
  • Thanks: 0
well after many hours... yes... haha

well you need this...
in your template need link this program is .js xkr.us/code/javascript/XHConn/ how do this... edit your html template in joomla (find the option) i changed class name to "ff_XHConn"

next step... your element have a option actionscript well you need next code
in this case i have the element "tpais, testado, tciudad" change tpais your value execute the code
how do this... element->actionscript->custom (option "change") click create code framework

my code do change testado's options and tciudad is clear...

other code you need is make a php file with your database querys... or make a component for joomla... (i'm learning)

i made a directory in joomla's root (/publico) and here made a php file... (your querys)

in php file your result must be something like this:

<option value="">Seleccionar</option>
<option value="2885">Aguascalientes</option>
<option value="73">Baja California</option>
<option value="74">Baja California Sur</option>
<option value="2886">Campeche</option>
<option value="62">Chiapas</option>
<option value="196">Chihuahua</option>
...
...
...
<option value="2887">Coahuila de Zaragoza</option>

function ff_tpais_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('testado').innerHTML = oXML.responseText;
ff_getElementByName('testado').disabled=false;
ff_getElementByName('tciudad').disabled=false;
};

ff_getElementByName('testado').disabled=true;
ff_getElementByName('tciudad').value = '';
ff_getElementByName('tciudad').disabled=true;
//myConn.connect("/publico/estados.php", "GET", "countryid="+ff_getElementByName('tpais').value, fnWhenDone);
myConn.connect("index2.php", "GET", "option=com_sensuales069&task=lregion&countryid="+ff_getElementByName('tpais').value, fnWhenDone);
} // ff_tpais_action

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

Re:how change values to select list...? 12 years 5 months ago #14172

  • samarga
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 1
  • Karma: 1
  • Thanks: 0
my solution

File Attachment:

File Name: selectlist.zip
File Size:53 KB
Attachments:

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

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

  • jem24h
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 15
  • Thanks: 0
Hi ! :)
I'm really interested by this topic, but I'm a newbie in programming and I don't really understand how to make it work.


With "raulsilva" method:
- I linked the JS file
- I retrieved the datas with the following PHP code :
<?php
$this->execPieceByName('ff_InitLib');

	//RETRIEVE DATAS IN FOR THE FIRST FIELD CALLED field1 AND STORE IT IN $test
	$test = "";
	mysql_connect("127.0.0.1","root","");
	mysql_select_db("PAT");
	$lien='Select * from TabMais6 group by col1';
	$image=mysql_query($lien) or die (mysql_error());
	while($uneligne=mysql_fetch_assoc($image))
		{
		$test .=  "0;{$uneligne['col1']};{$uneligne['id']}\n";
		}

	//RETRIEVE DATAS FOR THE FIRST FIELD CALLED field2  AND STORE IT IN $test2		
	$test2 = "";
	$lien='Select * from TabMais6';
	$image=mysql_query($lien) or die (mysql_error());
	while($uneligne=mysql_fetch_assoc($image))
		{
		$test2 .=  "0;{$uneligne['col2']};{$uneligne['id']}\n";
		}
		
	//FUNCTION THAT LIST DATAS 
	function ff_setSelectList($name, $value)
	{
		global $ff_processor;
		for ($r = 0; $r < $ff_processor->rowcount; $r++) 
		{
				$row =& $ff_processor->rows[$r];
				if ($row->name==$name)
				$row->data2 = $value;
				unset($row);
		} // for
	} // ff_setSelectList

	//CALL THE PREVIOUS FUNCTION TO LIST THE DATAS
    ff_setSelectList('field1', $test);
    ff_setSelectList('field2', $test2);
?>

It works fine, see below :


but the second field always give the same results (all the colors of col2 instead of those relatives to Animal 1).

My pb : I don't understand how to adapt the actionscript function to my case

May be samarga's method is easier, but I don't understand how to use this file at all; an explanation would be nice :)

Could anyone help me, please. :(
Attachments:

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 8 months ago #31941

  • jem24h
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 15
  • Thanks: 0
Hi ! :)

It's not working yet for me, but here is a start :


This is the actionscript adapted to my case
function ff_field2_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/estados.php", "GET", "field1="+ff_getElementByName('field1').value, fnWhenDone);
} // ff_tpais_action

And here is what I wrote as php code:
<?php
$field1=$_GET['field1'];
mysql_connect("127.0.0.1","root","");
mysql_select_db("PAT");
$lien2='Select * from TabMais6 where col1=\''.$field1.'\'' ;
$image2=mysql_query($lien2) or die (mysql_error());
while($uneligne2=mysql_fetch_assoc($image2))
		{
		$test2 .=  "<option value='{$uneligne2['id']}'>{$uneligne2['col2']}</option>\n";
		}
		return $test2;
		?>

With these code the 2nd field doesnt appears, see below


Please help me figuring out what's wrong with these codes
:)
Attachments:

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

Last edit: Post by jem24h.
Moderators: ForumSupport
Time to create page: 0.054 seconds

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

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!