TOPIC:

how change values to select list...? 13 years 3 months ago #6417

  • raulsilva's Avatar Topic Author
  • raulsilva
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 5
  • Thanks: 0
Hello:

i have 3 seleclists, when the first selectlist change how can i do change the second selectlist values with values from my database

Please Help me...

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

Re:how change values to select list...? 13 years 3 months ago #6444

  • TheMuffinMan
  • Visitor
  • Visitor
hi,

did you find a solution or need further assistance?

A good thing would be that you show us what you already did, maybe there are just some little additions necessary.

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

Re:how change values to select list...? 13 years 3 months ago #6450

  • raulsilva's Avatar Topic Author
  • raulsilva
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 5
  • Thanks: 0
well this are the steps:

step 1: load values from table1 to selectlist1
step 2: if selectlist1 change
load values from table2 (with selectlist1.option like filter)
to selectlist2
step 3: if selectlist2 change
load values from table3 (with selectlist2.option like filter)
to selectlist3

i have 3 tables with countries, regions and cities but are big to load on begin, for than i need generate query with choicen opcion

is posible do this?

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

Re:how change values to select list...? 13 years 3 months ago #6451

  • TheMuffinMan
  • Visitor
  • Visitor
sure, absolutely possible. but its not that easy to provide you with some code that works out of the box. need the whole view.

are you a bit into php and js programming?

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

Re:how change values to select list...? 13 years 3 months ago #6453

  • raulsilva's Avatar Topic Author
  • raulsilva
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 5
  • Thanks: 0
Yes, i can program in php and js... i need an idea or library to use....

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

Re:how change values to select list...? 13 years 3 months ago #6455

  • TheMuffinMan
  • Visitor
  • Visitor
great!

Best idea would be you put some php code that revtrieves the data from your db into a before form script (not piece). See the form settings, 2nd tab.

There you choose "custom" and click on "generate code framework".

Now, place your php code outside of that genereated function (best is on top).

e.g. you would do something like this:
var sel1Values = new Array();
var sel2Values = new Array();
<?php
$db = JFactory::getDBO();
$db->setQuery("...your select for values #1...");
$entries = $db->loadObjectList();

// now populating the data to js variables:
foreach($entries As $entry){
   echo 'sel1Values.push("'.addslashes($entry->value).'");'."\n";
}

// populating #2

$db->setQuery("...your select for values #2...");
$entries = $db->loadObjectList();

// now populating the data to js variables:
foreach($entries As $entry){
   echo 'sel2Values.push("'.addslashes($entry->value).'");'."\n";
}
?>

function ff_blabla.....

Now you have populated the variables using php and can use them inside the generated JS function to populate the select initially.

For the changes, you can put a "change" action on the select elements and here you can load the values from your previously gathered database tables.

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

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