Hi. I'm test-driving CC6 before buying it, and I'm stuck.
'
The goal is to use CF6 for a form to capture survey results.
On load, the table shows all results, which I might expect. When I change a value in the dropdown and click the button, nothing changes. I am unable to figure out how to apply the dropdown selection as a filter for the results table. I cannot find any examples of this in the forum or FAQs. Any suggestions?
Thanks!
'
The goal is to use CF6 for a form to capture survey results.
- I'm able to create a dropdown with the name question_dropdown which reads a table that contains questions and their key. The dropdown list the questions. The field name (if that's the appropriate term) is choose_question.
- I'm able to create a function that reads the data from the results table using {var:read_answer_table}. Each record of the results table contains
answers.user_id
answers.question
answers.answer - I've created a task button with the event set to view.
- I have an event called view, which contains:
{fn:read_question_table}
{view:question_dropdown}
{view:task_button7}
{fn:read_answer_table}
{view:Responses} - The function that reads the data has a where clause that begins answers.question: and tried concluding it with {data:question_dropdown}, {data:choose_question}, {var:question_dropdown}, and {var:choose_question}.
On load, the table shows all results, which I might expect. When I change a value in the dropdown and click the button, nothing changes. I am unable to figure out how to apply the dropdown selection as a filter for the results table. I cannot find any examples of this in the forum or FAQs. Any suggestions?
Thanks!
Try question:{data:blahblah} instead of answers.question
Thanks Healyhatman! That helped. The problem that remains is that I can't figure out what goes in the {data:} to pull in the value chosen in the dropdown. The debugger always shows it filtering on a blank (that is WHERE 'answers'.'question' = ''). I've tried:
question:{data:question_dropdown}
question:{data:choose_question}
question:{data:question_dropdown.choose_question}
The dropdown is using a key/value par of aid/question, so I've also tried:
question:{data:question}
question:{data:question_dropdown.question}
question:{data:choose_question.question}
All return blanks.
If I hard-code a response, such as question:3, the value shows up where you'd expect in the debugger, and the number of rows returned is the correct number, but the rows are all blank - only the column titles show.
So I'm still missing something regarding passing the selected value, and when I hard-code a selection, the rows are blank. In the table view, if I check "Include all provider fields", they appear.
Anyone have suggestions? Thanks in advance.
question:{data:question_dropdown}
question:{data:choose_question}
question:{data:question_dropdown.choose_question}
The dropdown is using a key/value par of aid/question, so I've also tried:
question:{data:question}
question:{data:question_dropdown.question}
question:{data:choose_question.question}
All return blanks.
If I hard-code a response, such as question:3, the value shows up where you'd expect in the debugger, and the number of rows returned is the correct number, but the rows are all blank - only the column titles show.
So I'm still missing something regarding passing the selected value, and when I hard-code a selection, the rows are blank. In the table view, if I check "Include all provider fields", they appear.
Anyone have suggestions? Thanks in advance.
{data:the ***NAME*** of the field you're sending}
Thanks. I apologize that I can't interpret your instructions accurately. I thought I had tried that.
Below is the configuration of my dropdown. the read_question_table pulls in a key/value pair aid and question. So is aid, choose_question or question_dropdown the name I should use? I've tried all three as question:{data:name}. All result in a blank in the WHERE clause.
Below is the configuration of my dropdown. the read_question_table pulls in a key/value pair aid and question. So is aid, choose_question or question_dropdown the name I should use? I've tried all three as question:{data:name}. All result in a blank in the WHERE clause.
Post a screenshot of your read data action too.
But you should be using {data:choose_question} given the screenshot above.
But you should be using {data:choose_question} given the screenshot above.
And you're saying that's not working? Post the full {debug:}.
Array
(
[option] => com_chronoconnectivity6
[cont] => manager
[conn] => survey-test
[event] => view_results
[_ga] => GA1.2.226007831.1505575861
[d3508fe47fbbb778d05025c46e258135] => YNX3ABvKytnF6DN-IVUQp3
[_gid] => GA1.2.426107557.1528764510
[d9ea4a41f5083d795fbc162759f58701] => 9k19Bc-rFD2Vx6Q-JibUj3
)
Array
(
[read_question_table] => Array
(
[log] => Array
(
[0] => SELECT `questions`.`aid` AS `questions.aid`, `questions`.`question` AS `questions.question` FROM `inyht_cf_questions` AS `questions` LIMIT 100;
)
[var] => Array
(
[1] => Test question 1
[2] => Test question 2
[3] => Test question 3
[4] => Test question 4
)
)
[read_answer_table] => Array
(
[log] => Array
(
[0] => SELECT `answers`.`user_id` AS `answers.user_id`, `answers`.`question` AS `answers.question`, `answers`.`answer` AS `answers.answer` FROM `inyht_chronoforms_data_test` AS `answers` WHERE `answers`.`question` = '' LIMIT 100;
)
[var] => Array
(
[0] => Array
(
[answers] => Array
(
[user_id] => 204
[question] => 0
[answer] => Answer 5
)
)
[1] => Array
(
[answers] => Array
(
[user_id] => 204
[question] => 0
[answer] => Answer 5
)
)
[2] => Array
(
[answers] => Array
(
[user_id] => 204
[question] => 0
[answer] => Answer 5
)
)
[3] => Array
(
[answers] => Array
(
[user_id] => 204
[question] => 0
[answer] => Answer 5
)
)
.
.
.
[50] => Array
(
[answers] => Array
(
[user_id] => 204
[question] => 0
[answer] => Answer 5
)
)
)
)
)
So the choose_question field isn't being sent. Since this is in CC make sure the dropdown is inside a form and that you're sending that form when you submit.
In the results, the value of [question] of zero exists in my test data. If I hard-code the WHERE to be 1, 2, 3 or 4, the resulting list includes the relevant records.
In the {debug:} the first array doesn't contain choose_question which means it's not being sent to your event.
I'm very new to CC6 ... I'll need to check out how to use the form properly, and then post an update.
Thanks!
Thanks!
Are you displaying data in a table? If not, does it NEED to be in CC or would you perhaps be better off making it in CF
The plan is to display the data in a table. I'm more familiar with CF, but I thought it might be easier to use CC for data filtering and display.
Right well here's what you should probably do.
Call your dropdown as {view:name} (the TOP name field) in a Custom element inside a Fields element
Call your fields element as {view:fields_element_name} inside a Form element
Set the event to whatever you need it to be. I have mine set to {data:event} so I can use the filters fields on any event
Call your dropdown as {view:name} (the TOP name field) in a Custom element inside a Fields element
Call your fields element as {view:fields_element_name} inside a Form element
Set the event to whatever you need it to be. I have mine set to {data:event} so I can use the filters fields on any event
Ah, that helped! It took a few trials, but it appears to be working. I was not using a form element, so the dropdown and the submit button were not in the right place.
Thank you very much!
Thank you very much!
Call your dropdown as {view:name} (the TOP name field) in a Custom element inside a Fields element
Call your fields element as {view:fields_element_name} inside a Form element
Hi
I have same problem also, but I didn't understand what is fields elemet and how to call it?
Thanks in advance!
Call your fields element as {view:fields_element_name} inside a Form element
Hi
I have same problem also, but I didn't understand what is fields elemet and how to call it?
Thanks in advance!
in CC there's a Fields element you can use, under Views
When I say "call" I mean use the shortcode to display or run it. So if the Fields element is named "myFields" you call it with {view:myFields}
When I say "call" I mean use the shortcode to display or run it. So if the Fields element is named "myFields" you call it with {view:myFields}
This topic is locked and no more replies can be posted.