HELLO.
I have a CF6 form with one group of "single use" fields and two groups of"repeat use" fields (using th -N- name notation).
I need to be able to save the data to 3 different tables: One Master Table for the "single use" fields and two Child Tables, with 1:M relationship from the Master table for the "repeat use" Child Tables and PrimaryKey->ForeignKey relationships to relate the data .
I cannot figure out how to do it, so all the help and pointers would be greatly appreciated.
Below is the array (as provided by debugger with some added comments by me so it makes easier to make sense of my array
Thanks is advance
I have a CF6 form with one group of "single use" fields and two groups of"repeat use" fields (using th -N- name notation).
I need to be able to save the data to 3 different tables: One Master Table for the "single use" fields and two Child Tables, with 1:M relationship from the Master table for the "repeat use" Child Tables and PrimaryKey->ForeignKey relationships to relate the data .
I cannot figure out how to do it, so all the help and pointers would be greatly appreciated.
Below is the array (as provided by debugger with some added comments by me so it makes easier to make sense of my array
Thanks is advance
Array
(
#SINGLE ELEMENTS (this line is my comment)
[option] => com_chronoforms6
[cont] => manager
[chronoform] => frmcredenciamento
[event] => submit
[strNome] => Ricardo José Carvalho
[strend1] => Logradouro
[strend2] => Complemento
[strCep] => 78049090
[strMunicipio] => Cuiabá
[strRg] => v697099k
[strCpf] => 75328666100
[strDob] => 11/01/1964
[strEmail] => carvalhorj@gmail.com
[strCelular] => 65 999999999
[strFixo] => 65 3512 2020
# REPEAT ELEMENTS 1 (this line is my comment)
[strCurso0] => y
[strQualificacao0] => qualificacao 1
[strAno0] => 1985
[strCurso1] => y
[strQualificacao1] => qualificacao 2
[strAno1] => 1986
[strCurso2] => y
[strQualificacao2] => qualificacao 3
[strAno2] => 1987
[strCurso3] => n
[strQualificacao3] => qualificação 4
[strAno3] => 1989
#REPEAT ELEMENTS 2 (this line is my comment)
[strMunicipio10] => 5100102
[strMunicipio20] => 5100201
[strMunicipio30] => 5100250
[strMunicipio40] => 5100300
[strMunicipio11] => 5100607
[strMunicipio21] => 5101803
[strMunicipio31] => 5102637
[strMunicipio41] => 5101704
[strMunicipio12] => 5102702
[strMunicipio22] => 5103858
[strMunicipio32] => 5103700
[strMunicipio42] => 5104807
[strMunicipio13] => 5103254
[strMunicipio23] => 5105903
[strMunicipio33] => 5105101
[strMunicipio43] => 5100102
)
Much easier if you name your repeater fields with group[number][field] notation. For example
Then each entry will be an array with grouped elements.
education[{var:area_repeater#.key}][qualification]
and
education[{var:area_repeater#.key}][curso]
etcetc
Then each entry will be an array with grouped elements.
Healyhatman, Super Help, thank you.
My array now provides me the following:
If you would be so kind
My array now provides me the following:
[Cadastro] => Array ( [0] => Array ( [strCurso] => n [strQualificacao] => No [strAno] => No ) [1] => Array ( [strCurso] => n [strQualificacao] => Yes [strAno] => Yes ) )No i just need some help in saving these items separately from the main data table....🤣
If you would be so kind
Loop event, data source {data:Cadastro}
Save event, data override set to
Save event, data override set to
foreignfield:{var:save_data#.primarykeyfieldname}
strCurso:{var:loop_event#.row.field}
etcetc
HealyHatman, hello
Finally i managed to srt it out with your invaluable help.
I had to create a Save event to save the main data, with a Loop_Event inside the success and a Save event inside the loop event for the child data.
I have the following overrides:
strCurso:{var:loop_event20.row.strCurso}
strQualificacao:{var:loop_event20.row.strQualificacao}
strAno:{var:loop_event20.row.strAno}
strCpf:{var:save_data19.strCpf}
All working fine and dandy.
But.....
the content of the table is showing some question marks ( on some (NOT ALL) the fields. (the source for strCurso is a dropdown, but strQualificacao and strAno are both text fields, setup in exact the same way)

whereas the array:
Thnx
Finally i managed to srt it out with your invaluable help.
I had to create a Save event to save the main data, with a Loop_Event inside the success and a Save event inside the loop event for the child data.
I have the following overrides:
strCurso:{var:loop_event20.row.strCurso}
strQualificacao:{var:loop_event20.row.strQualificacao}
strAno:{var:loop_event20.row.strAno}
strCpf:{var:save_data19.strCpf}
All working fine and dandy.
But.....
the content of the table is showing some question marks ( on some (NOT ALL) the fields. (the source for strCurso is a dropdown, but strQualificacao and strAno are both text fields, setup in exact the same way)

whereas the array:
Array ( [option] => com_chronoforms6 [cont] => manager [chronoform] => frmcredenciamento-copy [event] => submit [strNome] => José [strend1] => [strend2] => [strCep] => [strMunicipio] => [strRg] => [strCpf] => 999 [strDob] => [strEmail] => [strCelular] => [strFixo] => [strCadastro] => Array ( [0] => Array ( [strCurso] => yes [strQualificacao] => Yes [strAno] => Yes ) [1] => Array ( [strCurso] => no [strQualificacao] => No [strAno] => No ) ) [button34] => )Can u offer any suggestion?
Thnx
This topic is locked and no more replies can be posted.