Hello. I want update multiple fields.
I think that is wrong the Data Provider of Loop Function.
In fact, if I insert one of these field ({data:nome} or {data:formato} ), it work correctly.
But what is the array to update both fields.
I tried {data:} and {data:model_name_read_data}, unsuccessfully.
Thank you for your support.
I think that is wrong the Data Provider of Loop Function.
In fact, if I insert one of these field ({data:nome} or {data:formato} ), it work correctly.
But what is the array to update both fields.
I tried {data:} and {data:model_name_read_data}, unsuccessfully.
Thank you for your support.

What does your debug show. Use {debug:} at the end of the event.
This is with {data:} in loop function


Array ( [option] => com_chronoconnectivity6 [cont] => manager [conn] => BE_listini-copy [id_listino_2] => 3 [event] => update_pre_for_list [nome] => Array ( [182] => nome01 [183] => Nome02 ) [formato] => Array ( [182] => Formato01 [183] => Formato02 ) )
Array ( [update_pre_for] => Array ( [data] => Array ( [formato] => Array ( [182] => Formato01 [183] => Formato02 ) [nome] => Array ( [182] => Formato01 [183] => Formato02 ) ) [_success] => Data saved successfully [log] => Array ( [0] => UPDATE `xijhd_cf_prodotti_formati` AS `prefor` SET `formato` = '{"182":"Formato01","183":"Formato02"}', `nome` = '{"182":"Formato01","183":"Formato02"}' WHERE `id` = 'formato'; ) [var] => Array ( [formato] => {"182":"Formato01","183":"Formato02"} [nome] => {"182":"Formato01","183":"Formato02"} ) ) )
Put them both in an array format. So change the name to something like model[{var:table_list_name.row.model.id}][nome] so you're given an array of values on submit.
Change the name of the field to the thing I said
so:
- in text field of formato changed Name with Prefor[{var:prefor_list.row.Prefor.id}][formato], in text field nome with name Prefor[{var:prefor_list.row.Prefor.id}][nome],
In data provider loop I maintain {data:}
This is debug:
- in text field of formato changed Name with Prefor[{var:prefor_list.row.Prefor.id}][formato], in text field nome with name Prefor[{var:prefor_list.row.Prefor.id}][nome],
In data provider loop I maintain {data:}
This is debug:
Array ( [option] => com_chronoconnectivity6 [cont] => manager [conn] => BE_listini-copy [event] => update_pre_for_list [id_listino_2] => 3 [Prefor] => Array ( [182] => Array ( [nome] => Nome1 [formato] => Formato1 ) [183] => Array ( [nome] => Nome2 [formato] => Formato2 ) ) )
Array ( [update_pre_for] => Array ( [data] => Array ( [formato] => Array ( [182] => Array ( [nome] => Nome1 [formato] => Formato1 ) [183] => Array ( [nome] => Nome2 [formato] => Formato2 ) ) [nome] => Array ( [182] => Array ( [nome] => Nome1 [formato] => Formato1 ) [183] => Array ( [nome] => Nome2 [formato] => Formato2 ) ) ) [_success] => Data saved successfully [log] => Array ( [0] => UPDATE `xijhd_cf_prodotti_formati` AS `prefor` SET `formato` = '{"182":{"nome":"Nome1","formato":"Formato1"},"183":{"nome":"Nome2","formato":"Formato2"}}', `nome` = '{"182":{"nome":"Nome1","formato":"Formato1"},"183":{"nome":"Nome2","formato":"Formato2"}}' WHERE `id` = 'Prefor'; ) [var] => Array ( [formato] => {"182":{"nome":"Nome1","formato":"Formato1"},"183":{"nome":"Nome2","formato":"Formato2"}} [nome] => {"182":{"nome":"Nome1","formato":"Formato1"},"183":{"nome":"Nome2","formato":"Formato2"}} ) ) )
I think to be near to solution.
view formato - name model[{var:table_list_name.row.model.id}][formato]
view nome - name model[{var:table_list_name.row.model.id}][nome]
function -loop - data provider {data:model}
function - save data - data provider {data:} - data override nome - {var:save_pre_for_loop.row} - on update and formato - {var:save_pre_for_loop.row} - on update
This is debug, suggestion?
view formato - name model[{var:table_list_name.row.model.id}][formato]
view nome - name model[{var:table_list_name.row.model.id}][nome]
function -loop - data provider {data:model}
function - save data - data provider {data:} - data override nome - {var:save_pre_for_loop.row} - on update and formato - {var:save_pre_for_loop.row} - on update
This is debug, suggestion?
Array ( [option] => com_chronoconnectivity6 [cont] => manager [conn] => BE_listini-copy [id_listino_2] => 3 [event] => update_pre_for_list [Prefor] => Array ( [182] => Array ( [nome] => Nome1 [formato] => Formato1 ) [183] => Array ( [nome] => Nome2 [formato] => Formato2 ) ) )
Array ( [update_pre_for] => Array ( [data] => Array ( [option] => com_chronoconnectivity6 [cont] => manager [conn] => BE_listini-copy [id_listino_2] => 3 [event] => update_pre_for_list [Prefor] => Array ( [182] => Array ( [nome] => Nome1 [formato] => Formato1 ) [183] => Array ( [nome] => Nome2 [formato] => Formato2 ) ) [nome] => Array ( [nome] => Nome2 [formato] => Formato2 ) [formato] => Array ( [nome] => Nome2 [formato] => Formato2 ) ) [_success] => Data saved successfully [log] => Array ( [0] => UPDATE `xijhd_cf_prodotti_formati` AS `prefor` SET `nome` = '{"nome":"Nome2","formato":"Formato2"}', `formato` = '{"nome":"Nome2","formato":"Formato2"}' WHERE `id_listino` = '3'; ) [var] => Array ( [nome] => {"nome":"Nome2","formato":"Formato2"} [formato] => {"nome":"Nome2","formato":"Formato2"} ) ) )
Replace "table_list_name" with the name of your table list, replace "model" with the name of your model.
Done! I used example text, but in my work it's correctly complied (Prefor[{var:prefor_list.row.Prefor.id}][formato] - Prefor[{var:prefor_list.row.Prefor.id}][nome] - {data:Prefor})
This topic is locked and no more replies can be posted.