Ready made lists (for advanced developers)

indiana71 17 Jul, 2017
Hi, in old FAQs (http://www.chronoengine.com/faqs/58-cfv4/cfv4-elements-and-html/2647-how-do-i-build-a-select-drop-down-radio-button-or-checkbox-group.html) I found a link to this page

http://greyhead.org/index.php?option=com_chronoforms&chronoform=custom_select_gh&tmpl=component


Have you same component for the new Chronoform version 6 or can you suggest how to do?

I need a dropdown box with Years (from today to 100 years ago).

Thanks
GreyHead 17 Jul, 2017
Hi indiana,

In CFv5 you can do this using a Custom Code action to build the data array for the drop-down, I expect that you can do the same in CFv6.

Bob
indiana71 17 Jul, 2017
1 Likes
Yes, I've just did it. I report here for other users, if they need.

In form, Setup area, load section, I've added Logic -> PHP code.

I named it as "latest_100_years" and I put the following code:

$years = array_combine(range(date("Y"), 1900), range(date("Y"), 1900));
$label [] = '{l:year}';

return array_merge($label, $years);



I called from dropdown field, Options value, with the following code

{var:latest_100_years}
indiana71 17 Jul, 2017
and what for UniqueID for CF6?
In CF4 you wrote a custom obj...
GreyHead 18 Jul, 2017
Hi indiana71,

I'll see if I can do the same for CFv6 - at present I have no idea how to write a CFv6 action though.

Bob
indiana71 18 Jul, 2017
Have you the older code for UniqueID?
I think that we can use the Custom PHP module to generate the ID.

Thanks
Ciro
GreyHead 21 Jul, 2017
1 Likes
Hi Ciro,

If you have the CFv5 version then the code is in the /administrator/components/com_chronoforms5/chronoforms/actions/unique_id_gh/unique_id_gh.php file - basically there is a function to generate a random string and then a loop that checks to see if the string has already been used and saved in the database table.

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