hello,
I do not know how to explain my problem, I would like to achieve something like this
http://demos.chronoengine.com/index.php/chronoforms/dynamic-dropdown
the second drop down loading after making a selection in the first drop down
but do not know how you can do with ChronoForms
can you help me?
thanks
I do not know how to explain my problem, I would like to achieve something like this
http://demos.chronoengine.com/index.php/chronoforms/dynamic-dropdown
the second drop down loading after making a selection in the first drop down
but do not know how you can do with ChronoForms
can you help me?
thanks
thanks for the information but I can not make it work
I'll explain what I must do
I have a table with the names of customers and a Boolean field that identifies customers active or inactive
now in the form I added 2 drop down
the first I need to select whether the account is active or inactive (Field Name: tipologia)
the second would I load a list of customers based on the choice I made in the first (Field Name: cliente)
in the sections on load I added a custom code to retrieve customer names
right after I inserted an element Dynamic Dropdown
in Dynamic Dropdown I have set
Use AJAX? : Yes
AJAX Event name: cliente
Extra options extension:
the error is definitely in the use of drop down and the Dynamic Dropdown that I did not understand.
can you help me?
thanks
I'll explain what I must do
I have a table with the names of customers and a Boolean field that identifies customers active or inactive
now in the form I added 2 drop down
the first I need to select whether the account is active or inactive (Field Name: tipologia)
the second would I load a list of customers based on the choice I made in the first (Field Name: cliente)
in the sections on load I added a custom code to retrieve customer names
<?php
$db =& JFactory::getDBO();
$query_lista_clienti_a = "SELECT distinct(cliente) FROM sks_app_clienti WHERE abilitato=1";
$db->setQuery($query_lista_clienti_a);
$form->data['listaCDA'] = $db->loadAssocList();
$query_lista_clienti_na = "SELECT distinct(cliente) FROM sks_app_clienti WHERE abilitato=0";
$db->setQuery($query_lista_clienti_na);
$form->data['listaCDNA'] = $db->loadAssocList();
?>
right after I inserted an element Dynamic Dropdown
in Dynamic Dropdown I have set
Use AJAX? : Yes
AJAX Event name: cliente
Extra options extension:
<?php
$tipologia = $form->data['tipologia'];
$results = array();
$results[] = '=??';
if($tipologia == 1)
{
foreach ($form->data['listaCDA'] as $value)
{
$results[] = $value.'='.$value;
}
$results = implode("\n", $results);
echo $results;
$mainframe =& JFactory::getApplication();
$mainframe->close();
}
else
{
foreach ($form->data['listaCDNA'] as $value)
{
$results[] = $value.'='.$value;
}
$results = implode("\n", $results);
echo $results;
$mainframe =& JFactory::getApplication();
$mainframe->close();
}
?>
the error is definitely in the use of drop down and the Dynamic Dropdown that I did not understand.
can you help me?
thanks
ok, I had misread the guide and I have changed a bit 'of things🙂
in On Load I posted a Dynamic Dropdown action, and I set it this way:
Source Dropdown ID: tipologia
Target Dropdown ID: cliente
Use AJAX?: Yes
AJAX Event name: Ajax
Extra options extension: I have not added anything
I created the event On Ajax and I put in a Custom Code, where I wrote the following code:
but still does not work
in On Load I posted a Dynamic Dropdown action, and I set it this way:
Source Dropdown ID: tipologia
Target Dropdown ID: cliente
Use AJAX?: Yes
AJAX Event name: Ajax
Extra options extension: I have not added anything
I created the event On Ajax and I put in a Custom Code, where I wrote the following code:
<?php
$tipologia = $form->data['tipologia'];
$results = array();
$results[] = '=??';
if($tipologia == 1)
{
foreach ($form->data['listaCDA'] as $value)
{
$results[] = $value.'='.$value;
}
$results = implode("\n", $results);
echo $results;
}
else
{
foreach ($form->data['listaCDNA'] as $value)
{
$results[] = $value.'='.$value;
}
$results = implode("\n", $results);
echo $results;
}
$mainframe =& JFactory::getApplication();
$mainframe->close();
?>
but still does not work
Hi federcla,
Do you have a DB Multi Record Loader action in the Ajax event to get the data you want into the $form->data array (or a Custom Code action with a MySQL query)? My best guess is that there is no data to be processed.
Bob
Do you have a DB Multi Record Loader action in the Ajax event to get the data you want into the $form->data array (or a Custom Code action with a MySQL query)? My best guess is that there is no data to be processed.
Bob
ok, i have modify the code in On Ajax event
i'm sure that the query code work, because i had use that in another drop down and it work
it's possible that the problem is in setting of drop down?
i have set the first drop down in this way
General
Label Text: Tipologia
Field Name: tipologia
Options:
=
1=Attivi
2=Non Attivi
the second drop down:
General
Label Text: Cliente
Field Name: cliente
Dynamic Data
Enable: yes
<?php
$db =& JFactory::getDBO();
$query_lista_clienti_a = "SELECT distinct(cliente) FROM sks_app_clienti WHERE abilitato=1";
$db->setQuery($query_lista_clienti_a);
$form->data['listaCDA'] = $db->loadAssocList();
$query_lista_clienti_na = "SELECT distinct(cliente) FROM sks_app_clienti WHERE abilitato=0";
$db->setQuery($query_lista_clienti_na);
$form->data['listaCDNA'] = $db->loadAssocList();
$tipologia = $form->data['tipologia'];
$results = array();
$results[] = '=??';
if($tipologia == 1)
{
foreach ($form->data['listaCDA'] as $value)
{
$results[] = $value.'='.$value;
}
$results = implode("\n", $results);
echo $results;
}
else
{
foreach ($form->data['listaCDNA'] as $value)
{
$results[] = $value.'='.$value;
}
$results = implode("\n", $results);
echo $results;
}
$mainframe =& JFactory::getApplication();
$mainframe->close();
?>
i'm sure that the query code work, because i had use that in another drop down and it work
it's possible that the problem is in setting of drop down?
i have set the first drop down in this way
General
Label Text: Tipologia
Field Name: tipologia
Options:
=
1=Attivi
2=Non Attivi
the second drop down:
General
Label Text: Cliente
Field Name: cliente
Dynamic Data
Enable: yes
Hi federcla,
Sorry I'm late getting back to this.
At this point I'd use the Net tab in the Chrome Web Developer tools (or the equivalent in other browsers) to see exactly what is being sent back by the Ajax query. That gives you much more useful information than anything else. You can also add debug code which will display there to show you the query and the output.
Bob
Sorry I'm late getting back to this.
At this point I'd use the Net tab in the Chrome Web Developer tools (or the equivalent in other browsers) to see exactly what is being sent back by the Ajax query. That gives you much more useful information than anything else. You can also add debug code which will display there to show you the query and the output.
Bob
This topic is locked and no more replies can be posted.