TOPIC:

Dependant selects 2 weeks 3 days ago #250621

  • Topic Author
  • sebassp
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
Hi,

i have a view in CB conected to the DB with 2 Select options.

The first one let you choose the name and id from "test_table1"

what I want to do is the second select to display filtered fields (name2) based on the first select id


Test_table1:
id
name1

test_table2:
id
foreing key - name1(id)
name2

thx for your time

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

Dependant selects 2 weeks 3 days ago #250628

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

in item wrap code for name2 try something like this:
<?php
$db =& JFactory::getDBO();
$sql = "SELECT name1
FROM test_table1 WHERE id =$value";
$db->setQuery($sql);
$value = $db->loadResult();
?>

Hope this helps

Regards,
Tihana

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

Dependant selects 2 weeks 3 days ago #250670

  • Topic Author
  • sebassp
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
Thank you for your quick answer, it helped me solve one of my problems.

Even so i still need to find a way to do the next:

I have this first table named “gestión_carreras”
idnombre_carrera
1carrera_1
2carrera_2

Now i have this second table where “nombre_carrera” is a foreing key from the first table (id).
idnombre_materianombre_carrera
1materia_11
2materia_22

And this third table “gestión_cursada” is used to insert 2 foreign keys from tables 1 and 2 on this table, using two dropdowns.
idnombre_carreranombre_materiaalumno
111alumno1
223alumno1

Foreing keys:
Nombre_carrera (use id from table 1)
Nombre_materia(use id from table 2)


I adapted one of the codes from your forums to fill my first dropdown using the first table, and it works.
<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT nombre_carrera, id FROM #__gestion_carreras");
$contents = $db->loadObjectList();
$listdata = "Elegir carrera;0;\n";
for ($i = 0; $i < count($contents); $i++) {
                $listdata .= "{$contents[$i]->nombre_carrera};{$contents[$i]->id}\n";
}
$value = $listdata; 
?>

Now that i have an id selected in this first dropdown. I would like to know if it is posible to make the second to only show values from the second table that only have that id(nombre_carrera).

Sorry for the mess im pretty new with this.

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

Last edit: Post by sebassp.

Dependant selects 2 weeks 2 days ago #250677

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

this requires javascript code.
But as far as I understand you only use content builder. With ContentBuider alone you're not able to solve this. :(

Regards,
Tihana

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

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.049 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!