With Drupal 8, I have a form with two selects, both filled. I want to add a button/link after each of these two selects, looking like this.
The buttons, however, don't have a fixed link because the link target depends on what is selected in the select. Also, the link needs to open a new tab.
For example, if in the select "car1" the key "12345" is selected, the link should open /cars/12345; if "car2" is selected with the key "67890" then "/cars/67890"
This is the code I am using.
$form['select_g1'] = array( '#type' => 'select', '#prefix' => '<div class="container-inline">', '#title' => t('Select       '), '#options' => $contarray, '#empty_value' => '', '#default_value' => ($ext) ? $row['model'] : "", ); $form['button'] = array( '#markup' => ' <a target="_blank" href=""><span class="button js-form-submit form-submit"><img src="/sites/default/buttons/edit.png"></span></a></div>', );
Can someone help me there?