Forums

Reload Event CC6

rafaelscouto 13 Mar, 2018
I have two dropdowns and I need to load the 2nd information based on what I selected in the 1st.

In CF6 this works perfectly, but on CC6 I could not solve the problem.

What I already managed was to reload the field but it does not load the data.

In my view the problem is in Where Condition, I tried to do the same way of CF6 and some other ways, but when doing the reload of the field it says that no result was found. And when I leave this field (where conditions) open it loads all the data
Max_admin 15 Mar, 2018
Hi Rafael,

You can use a debug tag {debug:} in the reload event to test the values passed and use them correctly, what is the name of the 1st dropdown ?

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rafaelscouto 15 Mar, 2018
I will detail as much as possible, remembering that I have the same form working in CF6.

This form of CC6, I am using in the edit event, and it loads the data of a table, which in the case is a register of a certain type of user.

The same form, needs to load the data of State and City, which are two other tables.

According to images 01 and 02.

In "read_cidades", option, where Conditions put this, state: {data: state}.

In this case the same as the CF6.

1st dropdown "field_estate", see image 03.1 and 03.2

2nd dropdown "field_city", image 04.1 and 04.2

In image 05, there is the event that does the reload of the field_city and the function that loads the db cities.

Recharging is working normally, what is going wrong is:

The 2nd dropdown does not load the City database.

When I remove those codes from where conditions of db cities, the database reads all cities registered.

This ends up generating another problem, the non-binding between Cities and States.

I'm sorry for my English, I'm brazilian.

​[file=10219]CC6DropdownProblem.zip[/file]
rafaelscouto 22 Mar, 2018
Good Morning

The first example is the debug in CF6, it's working perfectly. In the data reader in "Where Conditions" I am using "estado: {data: estado}".
[pre][read_data15] => Array
(
[log] => Array
(
[0] => SELECT COUNT(`Model`.`id`) AS `Model.count` FROM `vsg5v_z_cidade` AS `Model` WHERE `Model`.`estado` = 'BA';[br] [1] => SELECT `Model`.`nome` AS `Model.nome`, `Model`.`nome` AS `Model.nome` FROM `vsg5v_z_cidade` AS `Model` WHERE `Model`.`estado` = 'BA' LIMIT 9999;[br] )[br][br] [var] => Array[br] ([br] )[br] [br] )[/pre]
[br]The second example is the debugging of CC6, here it does not work in the same way as in CF6.[br]In "Where Conditions" I have found that if I put "estado: {data.count:estado }" I have the same CF6 debug return, and this seems to be the correct path.[br]
[read_cidades] => Array
(
[log] => Array
(
[0] => SELECT COUNT(`Model`.`id`) AS `Model.count` FROM `vsg5v_z_cidade` AS `Model` WHERE `Model`.`estado` = '';
[1] => SELECT `Model`.`nome` AS `Model.nome`, `Model`.`nome` AS `Model.nome` FROM `vsg5v_z_cidade` AS `Model` WHERE `Model`.`estado` = '' LIMIT 9999;
)

[var] => Array
(
)

)
[br]The problem is that I can not get the value, how do I go about it?
Max_admin 04 Apr, 2018
Hi Rafael,

Please check the "Data" section of the debug in CCv6, what does it have ?

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rafaelscouto 06 Apr, 2018
I have two databases, one with the name read_states and another with the name read_cities.

I just need to know what to put in the "Where Conditions" field in the read_city database, since each city is linked to its respective state.

In CF6 just put state: {data: state}, but in CC6 it does not work this way.
rafaelscouto 09 Apr, 2018
I realized that if I leave the Name field of the drop down menu like this: city - I can retrieve the same data in CF6, but ...

I need this field to be as follows: Ger[city] because I load this data from a database.

And in the case, I'm doing this in the Edit event, so I already have a registration, but when I try to update it I get this problem.

I hope you understood.
Max_admin 11 Apr, 2018
Hi Rafael,

You can use {data:Ger.city} if the field name is Ger[city], but you first need to test which data is passed using the debug.

If this does not work then please post a list of the steps you follow to have the current solution in CC6

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rafaelscouto 11 Apr, 2018
I'm going to pass as old as possible.

I have two db, states and cities.

I register people using CF6 and then edit, if necessary, I use CC6.

In the register you need to add the fields State and City that are inserted through a drop-down menu.

No CF6 is running normally.

When I need to edit, I move to CC6, there's the problem.

In CC6, I have in the event (edit):

{fn: read_gers} - Read the db of Registered people.
{fn: read_states} - Reads the States
{fn: read_cities} - Read the Cities

So I can use the reload function of the dropdown City, I created another event called (read_cities), it has:

{fn: read_cities} - Read the Cities with each change in the State dropdown
{view: field_city} - Shows the City dropdown

In the City field, I have the "Name": Ger [city] so I can read which city was selected when creating the new cadastre.

In function, in the bd I have in "Where Conditions" Ger.state: {date: Ger.state} as you suggested, but it does not work.
Array
(
    [read_estados] => Array
        (
            [log] => Array
                (
                    [0] => SELECT `Ger`.`uf` AS `Ger.uf`, `Ger`.`nome` AS `Ger.nome` FROM `vsg5v_z_estado` AS `Ger`;
                )

            [var] => Array
                (
                    [AC] => Acre
                    [AL] => Alagoas
                    [AM] => Amazonas
                    [AP] => Amapá
                    [BA] => Bahia
                    [CE] => Ceará
                    [DF] => Distrito Federal
                    [ES] => Espírito Santo
                    [GO] => Goiás
                    [MA] => Maranhão
                    [MG] => Minas Gerais
                    [MS] => Mato Grosso do Sul
                    [MT] => Mato Grosso
                    [PA] => Pará
                    [PB] => Paraíba
                    [PE] => Pernambuco
                    [PI] => Piauí
                    [PR] => Paraná
                    [RJ] => Rio de Janeiro
                    [RN] => Rio Grande do Norte
                    [RO] => Rondônia
                    [RR] => Roraima
                    [RS] => Rio Grande do Sul
                    [SC] => Santa Catarina
                    [SE] => Sergipe
                    [SP] => São Paulo
                    [TO] => Tocantins
                )

        )

    [read_cidades] => Array
        (
            [log] => Array
                (
                    [0] => SELECT `Ger`.`nome` AS `Ger.nome`, `Ger`.`nome` AS `Ger.nome` FROM `vsg5v_z_cidade` AS `Ger` WHERE `Ger`.`estado` = '' LIMIT 999999999;
                )

            [var] => Array
                (
                )

        )

    [read_ger] => Array
        (
            [log] => Array
                (
                    [0] => SELECT COUNT(`Ger`.`id_ger`) AS `Ger.count` FROM `vsg5v_z_cad-ger` AS `Ger` WHERE `Ger`.`id_ger` = '635';
                    [1] => SELECT `Ger`.`id_ger` AS `Ger.id_ger`, `Ger`.`id_adm` AS `Ger.id_adm`, `Ger`.`created` AS `Ger.created`, `Ger`.`modified` AS `Ger.modified`, `Ger`.`nome_completo` AS `Ger.nome_completo`, `Ger`.`email` AS `Ger.email`, `Ger`.`cpf` AS `Ger.cpf`, `Ger`.`block` AS `Ger.block`, `Ger`.`rg` AS `Ger.rg`, `Ger`.`orgao_expedidor` AS `Ger.orgao_expedidor`, `Ger`.`celular` AS `Ger.celular`, `Ger`.`telefone` AS `Ger.telefone`, `Ger`.`endereco` AS `Ger.endereco`, `Ger`.`numero` AS `Ger.numero`, `Ger`.`bairro` AS `Ger.bairro`, `Ger`.`cep` AS `Ger.cep`, `Ger`.`estado` AS `Ger.estado`, `Ger`.`cidade` AS `Ger.cidade` FROM `vsg5v_z_cad-ger` AS `Ger` WHERE `Ger`.`id_ger` = '635' LIMIT 30;
                )

            [var] => Array
                (
                    [Ger] => Array
                        (
                            [id_ger] => 635
                            [id_adm] => 544
                            [created] => 2018-03-10 01:51:24
                            [modified] => 2018-03-21 17:02:05
                            [nome_completo] => ger
                            [email] => ger@rafaelscouto.com.br
                            [cpf] => 00000000000
                            [block] => 0
                            [rg] => 000
                            [orgao_expedidor] => 0
                            [celular] => (74) 98819-9939
                            [telefone] => (74) 3645-2149
                            [endereco] => AV CANDIDO RIBEIRO PERALVA
                            [numero] => 30
                            [bairro] => Centro
                            [cep] => 44790-000
                            [estado] => BA
                            [cidade] => Campo Formoso
                        )

                )

        )

)
gix.vax 06 May, 2018
1 Likes

In function, in the bd I have in "Where Conditions" Ger.state: {date: Ger.state} as you suggested, but it does not work.


date?
Ger.state: {data: Ger.state}
This topic is locked and no more replies can be posted.