I need to output one drupal form with other content. Here is my code:
$outputs="something else";
$outputs.=render(drupal_get_form(quotes_form));
function quotes_form(){
$form = array();
$form['arrival_city_1'] = array(
'#default_value' => 'Finland',
'#type' => 'select',
'#required' => TRUE,
'#options'=>array(
'China' => 'China',
'Finland' => 'Finland',
),
'#weight'=>2,
'#suffix'=>'</div>',
);
return $form;
}
The value "Filand" should be the default value. However, i check the html output:
<select id="edit-arrival-city-1" class="form-select required" name="arrival_city_1">
<option value="China">China</option>
<option selected="selected" value="Finland">Finland</option>
</select>
The selected value is correct in the code, but "China" is shown in the list filed. Anyone know why? thanks
Below code use in checkbox cases.You can create easily for selectboxes.
Thanks!