Display a dynamic text based on dropdown answer

Cugar 08 Dec, 2014
I would like to display a dynamic text in a text box based on a dropdown answer.

Basically, the user selects the year of birth and the respective event for his age group is displayed dynamically for a table.
The age group is changing every year - so that is why I'd like to reference a table rather than using js - depending the ajax is fast enough.

I followed the FAQ: How do I build a Double Drop-down in CFv5.
This works nice - however, I have only one 'selection' in the 2nd dropdown.
From there, I really don't want a dropdown - just a simple text box which is filled would be cool!

So, the problem is, how to return s.th. to simply fill a text box which can of course not be edited..

Thanks for help
Cugar 10 Dec, 2014
Figured, that I need some sort of dynamic event in the master drop down to trigger the ajax call.
There are:
1) Set Dynamic Options: This one seems to expect to get a json_encoded array back.

2) Set Dynamic HTML: This one sounds promising - but what is expected to be delivered back here??

I cannot find any hint in this forum about this functionality....

Thanks,
Cugar
Cugar 11 Dec, 2014
Any help possible? Is my description not clear? That's the last bit I need to finalize my form..
Thanks, Cugar
hgaleano 19 Jun, 2015
Hi Cugar

Sorry, because I see you did not have an answer here. Did you find any solution? I need the same. Thanks in advance if you can share your solution with me.
HugoG
GreyHead 20 Jun, 2015
Hi HugoG,

There is nothing 'built-in' to ChronoForms to do this. You can do it with custom JavaScript though. What do you actually need to display?

Bob
hgaleano 23 Jun, 2015
Hi Bob

Thanks for your answer. I found my own solution with these steps:

1. Event definition in my dropdown, to call a js function.
2. In my js function I used Ajax to call an external php. In this php file, I wrote a query to search in my table, and return a json array.
3. In ajax success, I wrote some lines of code to display the needed info.

I hope my solution, will be useful to somebody

HugoG
This topic is locked and no more replies can be posted.