Buy Now
Sign in

Dynamic dropdown with Repeater

Elitakey , December 03 2017
E
Elitakey
Hello, could anybody tell me how to implement dynamic dropdown with Repeater?
Demos form Dynamic dropdown contains PHP code that I cannot get working with the repeater probably because first dropdown name and ID has changed from
what_do_you_think to something like this: Model[{var:area_repeater3.key}
  • [what_do_you_think]. Im not good with the php, so would appreciate help.

    $options =
  • ;
    switch($this->data('what_do_you_think')){
      case 'good':
        $options = ['1' => '1', '2' => '2', '3' => '3'];
        break;
      case 'bad':
        $options = ['-1' => '-1', '-2' => '-2', '-3' => '-3'];
        break;
      case 'so':
        $options = ['good' => 'Good', 'bad' => 'Bad'];
        break;
    }
    return $options;