Forums

[Edit Form] - Double Dropdown

Fawaaz 14 Sep, 2015
Hello,

I have followed the following tutorial : https://www.chronoengine.com/faqs/70-cfv5/5232-how-do-i-build-a-dynamic-drop-down-in-cfv5.html to build a double dropdown which is working fine.
After creating an EDIT FORM, the code is not working anymore.
I tried editing the code for Condition in DB READ and Event on dropdown1, but nothing is working.
Do you have any idea?

I tried using the following but in vain
return array( 'MyDBfield1' => $form->data['MyEdit[dropdown1]'] );
return array( 'MyDBfield1' => $form->[b]MyEdit[/b]['dropdown1'] );


Working code on 'normal' form:
<?php
return array( 'MyDBfield1' => $form->data['dropdown1'] );
?> 


Custom code :
<?php
$options = array();
if ( !$form->data['Data'] || count($form->data['Data']) < 1 ) {
  // no result was found
  $options[] = 'NO selection';
} else {
  foreach ( $form->data['Data'] as $d ) {
    $options[$d['id']] =  $d['title'];
  }
}
echo json_encode($options);
?>
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount

{item:title} {images:#}