Buy Now
Sign in

Loop multiple field

ieraora , January 25 2020, 20:16
I
ieraora 130
January 25 2020, 20:16 #390913
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.
Annotazione_2020-01-25_210748.png
healyhatman 9
January 26 2020, 12:26 #390923
What does your debug show. Use {debug:} at the end of the event.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
I
ieraora 130
January 26 2020, 13:06 #390924
This is with {data:} in loop function
Annotazione_2020-01-26_140415.png
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"}
)

)

)
Attachments
Annotazione_2020-01-26_140415.png
Annotazione_2020-01-26_140415.png
(12.72 KiB)
206 Downloads/Views
healyhatman 9
January 26 2020, 13:36 #390925
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.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
I
ieraora 130
January 26 2020, 14:10 #390926
I'm very sorry, Put them both in an array format?
How can I do?
healyhatman 9
January 26 2020, 14:37 #390927
Change the name of the field to the thing I said
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
I
ieraora 130
January 26 2020, 14:56 #390928
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:
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
ieraora 130
January 29 2020, 07:27 #390955
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?

  
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"}
)

)

)

healyhatman 9
January 29 2020, 13:26 #390959
Replace "table_list_name" with the name of your table list, replace "model" with the name of your model.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
I
ieraora 130
January 29 2020, 13:31 #390960
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})
I
ieraora 130
February 02 2020, 11:18 #391003
 1
 Answer
I resolved my question. Below some images for your help.
Thank you jformicola for her images in this post https://www.chronoengine.com/forums/posts/t108029/update-field-loop-save?keywords=loop