Hi, I try to render with form api an input form element with the output syling like the image attached, using bootstrap input-group.
I try to do it of this way;
$form['sales_fee'] = [
'#type' => 'number',
'#step' => 'any', // Allow float numbers
'#min' => 0,
'#title' => $this->t('Applicable sales fee'),
'#default_value' => $config->get('sales_fee'),
//@todo This doesn't work
// '#prefix' => '<div class="input-group">',
// '#suffix' => '<span class="input-group-addon">€</span></div>',
];
The problem of this way is that he prefix are rendered BEFORE the input label, and the output aren't correct (see attached image 2). What is the best way to do this property?
I'm not sure if it's a support request, a bug or a feature request. Please change it if you see fit.
Thank in advance.
Comments
Comment #2
markhalliwellThat's because you need to use
#field_prefixand/or#field_suffixalong with#input_group:Comment #3
estoyausenteaaarg! Sorry :) Really thanks! It works perfect! :)