Joomla 4.x,
Module Backend:
Insert a field of type="combo" in any module mandatory file. For example in modules/mod_foo/mod_foo.xml.
<field
name="combotest"
type="combo"
label="combo test"
default="opt1"
>
<option value="opt1">opt1</option>
<option value="opt2">opt2</option>
<option value="opt2">opt2</option>
<option value="op3">opt2</option>
<option value="opt4">opt3</option>
</field>
A combobox with a dropdown button to select the options.
Like in HTML Code in J3:
HTML:
<div class="controls"><div class="combobox input-append">
<input type="text" name="jform[params][combotest]" id="jform_params_combotest" value="opt1" class="combobox" autocomplete="off" aria-invalid="false" data-com.agilebits.onepassword.user-edited="yes">
<div class="btn-group">
<button type="button" class="btn dropdown-toggle">
<span class="caret"></span>
</button>
<ul class="dropdown-menu" style="width: 265px; left: -219px; max-height: 150px; overflow-y: scroll; top: -138px;">
<li><a href="#" class="">opt2</a></li>
<li><a href="#" class="">opt2</a></li>
<li><a href="#">opt2</a></li>
<li><a href="#">opt3</a></li>
</ul></div>
</div>
</div>
Just an input field with autocomplete functionality
HTML:
<div class="controls">
<div class="awesomplete has-success"><input type="text" name="jform[params][combotest]" id="jform_params_combotest" value="opt1" class="awesomplete form-control valid form-control-success" data-list="opt1, opt2, opt2, opt2, opt3" autocomplete="off" aria-owns="awesomplete_list_1" role="combobox" data-com.agilebits.onepassword.user-edited="yes" aria-invalid="false"><ul role="listbox" id="awesomplete_list_1" hidden=""></ul><span class="visually-hidden" role="status" aria-live="assertive" aria-atomic="true" hidden="">No results found</span></div>
</div>
Joomla! 4.0.0-alpha5 Alpha
No need more...
Html code in layouts/joomla/form/field/combo.php for joomla 3.x
<div class="combobox input-append">
<input
type="text"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo $attr; ?>
autocomplete="off"
/>
<div class="btn-group">
<button type="button" class="btn dropdown-toggle">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<?php foreach ($options as $option) : ?>
<li><a href="#"><?php echo $option->text; ?></a></li>
<?php endforeach; ?>
</ul>
</div>
</div>
Html code in layouts/joomla/form/field/combo.php for joomla 4 alpha 5
Just:
<input
type="text"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"
<?php echo $attr; ?>
data-list="<?php echo implode(', ', $val); ?>"
/>
There is no "btn-group" coded
Labels |
Added:
?
|
Title |
|
||||||
Build | staging | ⇒ | 4.0-dev |
Status | New | ⇒ | Confirmed |
Category | ⇒ | Fields |
Labels |
Added:
J4 Issue
|
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-07-16 03:49:30 |
Closed_By | ⇒ | franz-wohlkoenig |
Closed as expected Behaviour. Please reopen if needed.
Added to Categorie "Fields".
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/23127.