private void buildHiddenSelectorWidget( SerialisationContext pSerialisationContext, HTMLSerialiser pSerialiser, EvaluatedNodeInfoItem pEvalNode, List<FieldSelectOption> pSelectOptions) { Map<String, Object> lTemplateVars = super.getGenericTemplateVars(pSerialisationContext, pSerialiser, pEvalNode); // Force the style to be off screen lTemplateVars.put("Style", "position: absolute; left: -999em;"); if (pEvalNode.getSelectorMaxCardinality() > 1) { lTemplateVars.put("Multiple", true); } // Always set size greater than 2, otherwise all fields post back with first value lTemplateVars.put("Size", Math.max(2, pSelectOptions.size())); List<Map<String, Object>> lOptions = new ArrayList<>(); OPTION_LOOP: for (FieldSelectOption lOption : pSelectOptions) { if (lOption.isHistorical() && !lOption.isSelected()) { // Skip un-selected historical items continue OPTION_LOOP; } Map<String, Object> lOptionVars = new HashMap<>(3); lOptionVars.put("Key", lOption.getDisplayKey()); lOptionVars.put("Value", lOption.getExternalFieldValue()); if (lOption.isSelected()) { lOptionVars.put("Selected", true); } if (lOption.isDisabled()) { lOptionVars.put("Disabled", true); } lOptions.add(lOptionVars); } lTemplateVars.put("Options", lOptions); MustacheFragmentBuilder.applyMapToTemplate( SELECTOR_MUSTACHE_TEMPLATE, lTemplateVars, pSerialiser.getWriter()); }