Forums

Import table data to the form...

Hypermushu 10 Aug, 2011
Dear Team,

Due to my poor English, I am using Google Translator.

I use Joomla V1.6.6, with J1.6 CronoForms V4. I have little knowledge in programming.

I need "load" the data from a table in my database to a field in the form created in ChronoForms. I read the manuals available ChronoEngine of the site, but still could not undertake such a task.

Example: when the user selects an option (states) in the "A" field "B" will show the options (cities) only the chosen state.

How can I do? You can guide a step-by-step?

I look back.

Sincerely,

Osmar


Success and Peace to all ...
GreyHead 11 Aug, 2011
Hi Osmar,

There are a couple of documents here on building double drop-downs; one using option groups (free), the other using Ajax (paid).

You will probably need help from someone with some progamming experience to get the Ajax version working.

Bob
Hypermushu 11 Aug, 2011
Hi Bob ...

I'll check if I can through its tip (group).

Any questions or solve the problem, I'll be in touch again.

Thank you.

Osmar
Hypermushu 11 Aug, 2011
Hi Bob ...

I tried various ways using the "Select Box", but do not know where I'm wrong. When I click on "View Frontend", the field appears empty.

See pictures and if possible to help me set up, because I tried to get the book you recommended me, but I did not have international credit card, and I could not buy it through the PayPal service





If you just help me load the data from the database to the form field will already be a big step.

I appreciate your help

Osmar
GreyHead 23 Aug, 2011
Hi Osmar,

Unfortunately you can't add options to a drop-down like this. It's more complicated than that.

What data do you need to get from the sep_cidades table? If it's just cidades_id and cidades than a Custom Element with this code will do what you need.
<?php
$db =& JFactory::getDBO();
$query = "
    SELECT `cidades_id`, `cidades`
        FROM `sep_cidades`;
";
$db->setQuery($query);
$data = $db->loadObjectList();
$options = array();
$options[] = "<option value ='' >==?==</option>";
foreach ( $data as $d ) {
  $options[] = "<option value ='{$d->cidades_id}' >{$d->cidades}</option>"; 
}
$options = implode("\n", $options);
?>
. . .
<select name='cidades' id='cidades' />
<?php echo $options; ?>
</select>

Bob
This topic is locked and no more replies can be posted.