No Code Attached Yet
avatar stAn47
stAn47
16 Feb 2026

Hello, we are using joomla to configure 2 remote systems and we render select dropdowns with options's values provided by external systems (exact.com).

It seems that choicesjs trims the value of the option and thus when you save the (j)form the values are not same as provided by external system and configuration is lost.

Example how to reproduce:

<joomla-field-fancy-select>
<select name="mytest">
<option value="">Please select a value</option>
<option value="4  ">ID4</option>
</select>
</joomla-field-fancy-select>

Choices change option's value to value="4" and thus when the page renders the "4 " is not selected per stored value. I believe this is very incorrect to change rendered option's values.

We load it via code below, but it's possibly irrelevant:

$doc = JFactory::getDocument();
														JHtml::_('jquery.framework');
														if (method_exists($doc, 'getWebAssetManager')) {
															$doc->getWebAssetManager()
																->usePreset('choicesjs')
																->useScript('webcomponent.field-fancy-select');
														}

best regards, stan

avatar stAn47 stAn47 - open - 16 Feb 2026
avatar stAn47 stAn47 - change - 16 Feb 2026
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 16 Feb 2026
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 16 Feb 2026
avatar sadiapeerzada
sadiapeerzada - comment - 7 Mar 2026

Hi, thanks for reporting this.

From the example provided it appears that ChoicesJS trims the value of the <option> element (e.g. value="4 " becoming value="4"), which would indeed cause issues when the stored value contains trailing spaces.

I’ll try to reproduce this behavior with joomla-field-fancy-select and check how the value is handled when ChoicesJS initializes the select field. If confirmed, we may need to ensure that option values are preserved exactly as provided rather than being trimmed.

I’ll report back once I’ve tested it locally.

avatar brianteeman
brianteeman - comment - 10 Mar 2026

Have you verified if the same trim happens upstream with choicesjs or is it specific to the Joomla implementation. If it happens upstream then I dont think there is anything we can do here and you should raise an issue directly with choicesjs

Add a Comment

Login with GitHub to post a comment