Buy Now
Sign in

Save Data from repeatable Form

Proximate , February 20 at 17:10
Answered
P
Proximate
Hi
I've now figured out how to create Repeatable Forms. Next Issue is, i am not able to bring the Save / Update Function of a "repeatet Form" to Work.
I hope i am missing just spomething simple, unfortunately i was not able to debug before save (?) like "show me what we try to save"
DB Structure:
aio_packs --> contains all Packages (Master)
aio_equipment --> contains all Equipments
aio_package_equipment --> Defines which Equipment should be listed inside which package and the amount (once, twice and so on)
A Repeater View contains the form with the fields for ID, Amount, Text Identifier (read Only), Update and Delete Button
to display a value in the form field for the actual amount i added this into the Value field: {var:repeater_equipment_edit_view.row.Data.equipment_amount}
Field names are: "Data[id]" "Data[equipment_amount]"
Save Button has its own ID : "button_{var:repeater_equipment_edit_view.row.Data.id}"
The form looks actualy like that (inwork):
Bildschirmfoto_2018-02-20_um_18.05.49.png
The Problem now is, the Save function can't handle the inputs, nothing happens on the DB on Save. Data Provider is set to {data:Data}
Second: for some reason it reloads all "Amount-Fields" with the changed value, but just in the view, nothing on the db.
I have also created another view called simple_edit (just to check if the save function works) - this one saves a new entry in the db (which i think is ok because there are no related data informations for ID on form load).
i've attached the SQL and a Backup aswell.
Please be kind, its still "work in progress" :-)
Thx for your feedback & sorry for the long Post
P
Proximate
Additional info:
I added now hidden fields for each table column - if i click on save the page blinks short and then i have the following debug:
Array​
​(​
​ [option] => com_chronoconnectivity6​
​ [cont] => manager​
​ [conn] => all-in-one-packages​
​ [pack_id] => 2​
​ [event] => edit​
[Data] => Array​
​ (​
[id] => 2​
​ [package_id] => 2​
​ [equipment_id] => 1​
​ [equipment_amount] => 90

​ )​
​​
​ [button4] => ​
​ [8fd29f445baa6933f74c2d3c5d0c496e] => a55246f88b6c612763d33b319ca4a942​
​ [23e820ba035e658a94025b4a02bea2fb] => 62012e29f9432b65cbd3f916a9468443​
​)
As far as i understand, save function should be able to process the Data if i set Data Provider to {data:Data} (Save Model is also Data but that isnt important isn't it?)
kind regards
Proximate
admin
Hi Proximate,
Do you have a loop function to handle the repeater save ? if not then please check the Chronoforms6 manual in the downloads page as it explains how to do that.
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
P
Proximate
Hi Max
Thanks for your fast response - no actualy i did not use the Loop for saving - but i have a save button (Refresh) Button for each element something like:
form start
id
name
amount
save button
form end
form start
id
name
amount
save button
form end
form start
id
name
amount
save button
form end
... and so on so i save just one element is this not possible?
the main idea is to have a later an inline form for each element.
Kind regards
Proximate
P
Proximate
Its ok now
i rebuilded the whole thing now based on your Dynamic example via Table view and Inline Edit and Update all Button. less complicated and works like a charm :-)
Checkout the dynamic example with table view and the Loop Function for save