Hi all,
I am using Chronoforms 5 in combination with Joomla fields. I want to populate my dropdown field with values found in one of the Joomla Fields.
I want to split the data above to the following
I am using Chronoforms 5 in combination with Joomla fields. I want to populate my dropdown field with values found in one of the Joomla Fields.
1,2 or 3,4
I want to split the data above to the following
<option>1,2</option>And I want to add this to the dropdown field. Does anyone know how to do this? I know how to split the values, but I don't really know how to add the dynamic data to the field.
<option>3,4</option>
Hi huubs,
I'm not clear what you are doing here. You probably need to use PHP to convert your data to an array in the $form->data then you can add that to the drop-down options.
Bob
I'm not clear what you are doing here. You probably need to use PHP to convert your data to an array in the $form->data then you can add that to the drop-down options.
Bob
Hi Bob,
Thanks for your reply. I have an article with a couple of Fields attached to it (com_fields), and in that field there are is data filled in. Now I have 1 article that I insert into every article, so I don't have to make a new form for every article I have. In this form I extract the article name and fill that into the field, so the administrator knows what article form is filled in. But I digest.
I want to add a new functionality to make a dropdown filled with the options based on the values in the Field component. But I'm not sure how to add these into the dropdown field, before the form is rendered. Any idea in how I can do that? I can make an array with the options, but how do I actually insert this array to the dropdown options?
I know for example I can fill a text field via $form->data['namefield'].. But how can I fill in the options for a select field?
Thanks for your reply. I have an article with a couple of Fields attached to it (com_fields), and in that field there are is data filled in. Now I have 1 article that I insert into every article, so I don't have to make a new form for every article I have. In this form I extract the article name and fill that into the field, so the administrator knows what article form is filled in. But I digest.
I want to add a new functionality to make a dropdown filled with the options based on the values in the Field component. But I'm not sure how to add these into the dropdown field, before the form is rendered. Any idea in how I can do that? I can make an array with the options, but how do I actually insert this array to the dropdown options?
I know for example I can fill a text field via $form->data['namefield'].. But how can I fill in the options for a select field?
I got it working by using the Joomla session. I set the session data and retrieve it in a custom code in Chronoforms. Then I set the dynamic data via the dynamic data drop down option.
$session = JFactory::getSession();
$data = explode("or", $session->get('data'));
foreach ($data as $value) {
$form->data['data'][] = array('value' => $value, 'text' => $value );
}
This topic is locked and no more replies can be posted.