Forums

Save specific data from another table in the record of the form

MarcoMeme 18 Aug, 2014
I'm new, I did a lot of research before opening a topic.
I would like my form registers in addition to the things that asks for some parameters in another table of another component, of course without showing it to users. The componetente is Community Builder and the table is comprofiler. I can upload the records from the table using DB record loader, but then I do not understand what should I do to save them in the same record on the form, of course these data should only be those related to the user who performs the submit. And of course I state that will have access to the form only registered users, why put the form in an article only visible to registered users.

How should I proceed? Please help me out as quickly as possible.
Thank you.

PS: The idea is that the record that I will have to be addressed via these fields that are in the table comprofiler. Since I have to use the codes entered by the user at registration.

Sorry for my English but know little about this language and I'm using google translator.
GreyHead 18 Aug, 2014
Hi MarcoMeme,

You can save data to the CB tables in exactly the same way as any other table. You need to know the record ID of the record that you want to update and the column names in the table. This data should then be in the ChronoForms $form->data array (either submitted from the form or added in Custom Code actions) before you run a DB Save action.

I don't use CB and don't know what the structure of their database tables is.

Bob
MarcoMeme 18 Aug, 2014
Hi GreyHead,

thanks for your reply. I want to save the data that are relevant to the user logged. then the id is that of the user logged in? But not being an expert in the procedure I would like to know what to do in detail. I know the structure of CB. Knowing the table to be queried what should I do to load and then save the data of the columns that interest me. Obviously, what have i do to asking chrono to find the right id relatively user logged in? In the forum there is a guide on what I'm trying to do, even relative to another table that is not related to CB?
MarcoMeme 18 Aug, 2014
deeply sorry but maybe my English does not allow me to fully understand or maybe I'm not finding the right words to explain what I want. I do not know if I want to do is possible. I try to explain it in a rude way. I want prendre data from a table and save them in the record without the user knowing about it. These data have to be derived by the person who is sending the form. I do not know if I'll explain in a clear way? I do not know if I'm doing the right questions? I have seen the guide but I could not understand.
Sorry for my english. Help me step by step i think is the only way. Sorry sorry sorry...
Max_admin 18 Aug, 2014
Hi,

After you load the data using the "db record loader", just map the fields in the data array to match the fields names of the new table, I suggest that you "load the data under model id", let's say the model is "CB", then use a "custom code" action:

<?php
$form->data["new_table_field"] = $form->data["CB"]["first_name"];

Then a "db save" action to your new table!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 19 Aug, 2014
Hi MarcoMeme,

I suggest that you try doing a very simple test form with just one input. Take it step by step and tell us when you have a problem.

Bob
MarcoMeme 19 Aug, 2014
I understand some things, but I could not understand the meaning of "load the data under model id". Could you explain this step to me very difficult?

While
<?php
$form->data["new_table_field"] = $form->data["CB"]["first_name"];


new_table_field: is an element in previuw
["CB"]["first_name"]: is a field in the table that i want to load

Thanks.
MarcoMeme 19 Aug, 2014
element in the preview can be a hidden box because I do not want the fields to be viewed by the user?
GreyHead 20 Aug, 2014
Hi MarcoMeme,

ChronoForms keeps the form data in an array called $form->data[''] that is where data is saved after the form is submitted - and also when it it loaded. If you add a Debugger action you can see the data displayed.

A Model ID for data loaded from a different source just creates a sub-array of the $form->data[''] array like $form->data['user_info'] This is helpful when you want to be able to access a set of data rather than just a singe value.

If you don't want data viewed by the user then you don't need to access it in the On Load event - you can get it in the same way after the form is submitted.

Bob
MarcoMeme 20 Aug, 2014
questi campi che carico con db record loader possono essere immagazzinati in un text box non editabile dall'utente.
MarcoMeme 20 Aug, 2014
these fields that load with db record loader can be stored in a text box can not be edited by the user.
Max_admin 20 Aug, 2014
@Marco, if you want the data to appear on the form then load them in the "on load", but if you just want to use them after the form is submitted then you can load them at the "on submit" directly.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.