Chained Combo in CMS Builder

2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 20, 2012   (RSS)

Hello,

Let's said i have a car rental web site.
I have 3 sections

1/ Mark (Bentley, Mercedes, BMW...)
2/ Models (300C, 318i, Z4...), which are linked to section 1 upper.
3/ Cars (mark,model,price,description, photo)

So admin-side, when i create or modify a "CAR"

- i choose the "MARK" (linked to section 1)
- i choose the "MODEL" (linked to section 2)

How can i refresh the combo MODEL depending on the choice in the combo MARK?
I know this is possible, but there is no documentation of how to acheive this in CMS Builder.

This is pretty urgent.
Thanks a lot.

Re: [moolood] Chained Combo in CMS Builder

Hi,

In your car section you will need to create the following fields:

First you will need to set up your mark drop down field using the get options from database (advanced) so that it uses num for the value.

Next create your model dropdown using the list field type. In the options for this field select dropdown from the radio button list and get options form MySQL query (advanced) from the list options. (see Attached screenshot).

In the text area for the MySQL query you need to create a query that will select the two columns you want to be used for the value and title of the options. The where statement uses the $ESCAPED_FILTER_VALE, which is retrieved from another field on the page using the advanced filter dropdown below the where statement text area. Below is an example of the where statement I used in my test:

SELECT num, title
FROM `<?php echo $TABLE_PREFIX ?>model` WHERE mark = '<?php echo $ESCAPED_FILTER_VALUE ?>'


You'll need to modify this example to work with how you have your sections set up, but hopefully it will give you an idea of how to set everything up. Let me know if you want me to clarify anything.

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com
Attachments:

screenshot.png 23K