TOPIC:

Action Script Select List BreezingForms dependiente desde BBDD 4 weeks 2 hours ago #259339

  • Topic Author
  • shenares
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 37
  • Thanks: 0
Hola,

Me gustaría crear una lista dependiente de 2 campos, Customer y Model. El primer campo, Customer tiene una lista desplegable que contiene un script que accede a la base de datos y muestra los valores. Este script esta insertado en la parte Init Script como sigue (funciona correctamente):
<?php

$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object

//Create your own query here
$db->setQuery('Select Customer From jos_Projects');

$result = $db->loadColumn(); //load the result from the query
$test = "";
for ($i = 0; $i < count($result); $i++)
{
$test .= "0;".$result[$i].";".$result[$i]."\n";
}

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

ff_setSelectList('CselRegion', $test);
?>

Lo que me gustaría es que cuando se seleccionara cualquier valor se incluyera otra lista en el campo Model que contenga otra sentencia SQL dependiente del valor de Customer (Select ModelFrom jos_Projects Where Customer = ValorSeleccionado). Tengo la sentencia en el campo de Action que me muestra un valor fijo, pero me gustaría poder seleccionar lo dicho anterior:

function ff_CselRegion_action(element, action)
{
country = ff_getElementByName('CselCountry');

var CustomerSeleccionado = new Array(
'Model1', 'Model2', 'Model3'
);

if (element.value == 'none') {
// drop countries
while (country.options.length > 0)
country.options[country.options.length-1] = null;
} else {
// get the matching array
var selectedArray = eval('CustomerSeleccionado ');

// drop supernumerous option
while (selectedArray.length < country.options.length-1)
country.options[country.options.length-1] = null;

// add the new options
country.options[0] = new Option('Select Country', 'none', true, true);
for (var i=0; i < selectedArray.length; i++)
country.options[i+1] =
new Option(selectedArray, selectedArray);
} // if

// drop states
while (state.options.length > 0)
state.options[state.options.length-1] = null;
} // ff_CselRegion_action

En esta parte ""var CustomerSeleccionado = new Array('Model1', 'Model2', 'Model3');"" es donde me gustaría poder incluir la busqueda en la base de datos pero no he podido realizarlo, ¿alguien puede ayudarme?

Gracias de antemano!

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

Action Script Select List BreezingForms dependiente desde BBDD 3 weeks 6 days ago #259345

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6086
  • Karma: 3
  • Thanks: 429
Hi,

I hope we can continue in english.

I have a one question:
when someone select value from first select list Customer->then second select list Model will be filled from the database depending on the selected value of select list Customer?

Regards,
Tihana

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

Action Script Select List BreezingForms dependiente desde BBDD 3 weeks 6 days ago #259353

  • Topic Author
  • shenares
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 37
  • Thanks: 0
Hi!

Sure, you can continue in English!

Regarding your question, yes, the idea of execution is just what you mentioned.

Thanks!

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

Action Script Select List BreezingForms dependiente desde BBDD 3 weeks 6 days ago #259354

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6086
  • Karma: 3
  • Thanks: 429
Hi,

you have to use AJAX to send the value to an external PHP file which queries the database and sends it back to the form(without reloading the site). You should find all informations needed in this topic:
crosstec.org/de/forums/15-usage/99554-po...?limitstart=0#115924

Let me know if you get in stuck with this method

Regards,
Tihana

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

Action Script Select List BreezingForms dependiente desde BBDD 3 weeks 6 days ago #259358

  • Topic Author
  • shenares
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 37
  • Thanks: 0
Hi,

Thanks for the support!

Regarding PHP file, it can be included in action scrtip side or is neccessary create a file in my web?

BR,

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

Action Script Select List BreezingForms dependiente desde BBDD 3 weeks 6 days ago #259360

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6086
  • Karma: 3
  • Thanks: 429
Hi,

php file should be created in joomla folder, and then in action script in url, write path to that php file

Regards,
Tihana

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

Moderators: ForumSupport
Time to create page: 0.054 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!