Buy Now
Sign in

Send the data in two differents table

gebonimo , November 12 2017
G
gebonimo
Hi everyone.

Thanks for this template which is wonderful.

I'm trying to build a form with CF v6. In this form i'm gonna have 3 differents datas all linked with FK (i created the foreign keys in my database).

I wanted to know how i can divide the informations filled in my form to redirect them in the right table and link them correctly.

I tried to create two differents data save event when submit button is clicked but i don't know with which informations i should configure them.

Can you please help me ? I can provide screenshot if needed.

Thank you.
admin
Hi,

Please use models names in your form fields names and in the "save data" actions " data provider, for example, you may have form fields names as model1[name] and model2[email] then use {data:model1} and {data:model2} in the 2 "data providers" in the save actions.

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!
G
gebonimo
Hey.

Thanks for the answer.
Let just admit that my data1 is in a field_text1 contained in a fieldset_area8 and my data2 is in field_text2 in an area_repeater4.

I tried {data:field_text1} or {data:fieldset_area8} in the data provider of my db save action and both didnt just select the data i wanted. It saved all the form
G
gebonimo
Sorry for double post but i'm trying to stick with what you said.

Where do i write the "model names". I apparently, do no know which one use.
Here is my backup. At the moment, i'm just trying to save half of my form in one table and make the rest like nonexistent. Just to see if I'm able to isolate one data.

I needed i can upload also the version with both data save.
Attachments
lala_13_Nov_2017_10_18_12.cf6bak
(8.76 KiB)
22 Downloads/Views
admin
Hi gebonimo,

You need to group the fields by the models names, so for your first table fields, name the fields model1[field1] and model1[field2]...etc

Then use {data:model1} in the data provider of the save data action to the first table

Same rule for 2nd table

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!
G
gebonimo
Ok I finally go it. If i have time i'll do a tutorial with screenshots to make it clearier for the next one wondering.

Right now I'm trying to save a repeater area in the second table. I've made a loop event but in this table I need to get the 'id' of the last entry from the first db save i've made.

I don't know if i'm clear.

Let's say:

Model 1 -> DB Save -> insert id, value and fk1
Model 2 area repeater -> DB Save insert id, value, fk1, Model1.id

How can i do ? Right i'm doing a data read before the data save to get back the id.

Thanks
G
gebonimo
I succeed to save the id but now i'm in trouble saving the data from my repeater area.
And all the doc i find are very "cloudy" for me...

Can you ELI5 me please how to configure a are_repeater correctly and save it ? I can't even see what the debugger says since I always have a SQL error saying my fields are empty (while they are not).

EDIT: I filled the model name correctly by following the FAQ and the manual.
admin
Hi gebonimo,

You can add a stopper action before the "save data" in order to block it and display the debugger info before that, you must make sure that the correct data is supplied to the "save data" action.

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!
G
gebonimo
Thank you for all the responses. I finally succeeded to create the form i wanted. I close the topic