Forums

dynamic dropdown + update field text

cyber81 01 Aug, 2018
in chronoforms5 I had some form with text fields that were updated based on the choice made in a dynamic dropdown.

In chronoforms6 I have difficulties.
This is the procedure that I have implemented and that does not work:
I have a data4 read in setup that I recall in the "option" section of the dropdown with {var: read_data4}.

OK so far it works.Then in relation to the chosen value I want to update the text field with another value of that array.
So I inserted the following code in a new read to the "Filter settings" section:
<?php
return array('cognome_lavoratore' => $form->data['cognome_lavoratore']);
?>
which is taken as data7.

So in the "on found" event I entered a php code of this type:
<?php
$options = array();
foreach ($form->data['data7'] as $d) {
$options[$d['id']] = $d['cognome_lavoratori'];
}
echo $options[$d['id']];
?>
All this referred to as reload to the text field that must change.

Does anyone have any ideas? Thank you
GreyHead 03 Aug, 2018
Hi cyber81,

The first problem that I see is that CFv6 does not use $form->data - please check the manual and the Variable Shortcodes FAQ.

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