Forums

Reading data from table, but can't figure out how to load the results in a form

farscape 29 Aug, 2018
I've been scouring the forum, and can find topics close to what I'm trying to do but not close enough for me to fill in the gaps. I'm using a read_data to pull data from a table. The debugger shows the results I want.

The form is a survey where users identify areas they want to volunteer. I've got that working. I want to create a multi-page form that has that in the first page. After submitting the first page. the second page would pull up just the options that the user checked, and allow him/her to check an additional box to indicate in three of those records to show which are their top three preferences.

My challenge is loading the selected options into a CF6 form to allow the user to update.
  1. If I have several records, what action do I use to actually display? It doesn't seem that the repeater makes sense, unless I use a count of the records to set the multiplier.
  2. How do I load a value into a field? I've tried every variation of {var:blahblah} I can think of .... {var:model.fieldname}, {var:model.[n].fieldname}, {var:fieldname}, etc. etc. All lead to a blank in the field.
I've seen several posts that talk about using CC6 for the update. I'm happy to go that route, but I can't find anything that clearly explains how to pass a parameter (the survey's header record ID) from CF6 to CC6. I've found couple of posts that talk about passing from CC6 to CF6, but not the other way, and even those don't full explain. This one, for example. It mentions {chronoforms:aForm}. Is that a parameter you set as a redirect parameter in a redirect action? And in that example, is "aform" simply the form name? That post says "Any available parameters will be available in the form, example, if you can use {data:xyz} or {var:whatever} in the connection then it will be available the form too". Does that mean that if the parameter is a form name, that all {data:} options from the CF6 form are available for use in the CC6 form?

Thanks in advance!
healyhatman 29 Aug, 2018
Step 1 : Always include a debug action at the end of your event (so after the section is displayed, after all your data reads etc - that way you can very easily see all the data and how it's structured.

To put a read value into a field :
{var:read_data#.model.field}

For the repeater area:
In "data provider" put {var:read_data#} (obviously, replace the # with the right number for your read data action). All the data will now be available in {var:repeater_area#.row}
So if you want a checkbox in each repeater that when checked sends the id of the row, you would use as the value
{var:area_repeater#.row.model.field}

For your purposes I probably wouldn't bother calling a CCv6 connection from within your form unless you need to display more information and you want it in a table.

And what that "all the parameters are available blahblah" means is that for example if you do a read_data in your chronoforms and then call a CCv6 connection after it, the data from that read_data# will be available for use in the connection too.
farscape 29 Aug, 2018
Thanks HealyHatMan. I'm a step further, but still can't successfully put values into the fields, so I'm still missing or misunderstanding something. Here's where I am in a test form:

Read_data4 has a model called tester, pulling in aid and email.

Here is the repeater setup:



Here's a field in the repeater body:



Here is the debugger:



The result remains blank fields:

healyhatman 29 Aug, 2018
Answer
have another read of what I wrote under repeater area. Code section
farscape 30 Aug, 2018
Thanks! I did, and I also saw that I needed to use area_repeater# instead of repeater_area#, but that got it.
konta89 06 Sep, 2018
Hi,

I have doubt with this, If I have several records, what action do I use to actually display?

It doesn't seem that the repeater makes sense, unless I use a count of the records to set the multiplier.

Regards,
Manish
This topic is locked and no more replies can be posted.