unset options when none exist (#27348)
Closes #25110 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
b9d92075ae
commit
6c0f7444b5
1 changed files with 11 additions and 10 deletions
|
@ -146,13 +146,14 @@
|
||||||
<#assign options=attribute.validators[attribute.annotations.inputOptionsFromValidation].options>
|
<#assign options=attribute.validators[attribute.annotations.inputOptionsFromValidation].options>
|
||||||
<#elseif attribute.validators.options?? && attribute.validators.options.options??>
|
<#elseif attribute.validators.options?? && attribute.validators.options.options??>
|
||||||
<#assign options=attribute.validators.options.options>
|
<#assign options=attribute.validators.options.options>
|
||||||
|
<#else>
|
||||||
|
<#assign options=[]>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if options??>
|
<#list options as option>
|
||||||
<#list options as option>
|
|
||||||
<option value="${option}" <#if attribute.values?seq_contains(option)>selected</#if>><@selectOptionLabelText attribute=attribute option=option/></option>
|
<option value="${option}" <#if attribute.values?seq_contains(option)>selected</#if>><@selectOptionLabelText attribute=attribute option=option/></option>
|
||||||
</#list>
|
</#list>
|
||||||
</#if>
|
|
||||||
</select>
|
</select>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
|
@ -162,21 +163,22 @@
|
||||||
<#assign classDiv=properties.kcInputClassRadio!>
|
<#assign classDiv=properties.kcInputClassRadio!>
|
||||||
<#assign classInput=properties.kcInputClassRadioInput!>
|
<#assign classInput=properties.kcInputClassRadioInput!>
|
||||||
<#assign classLabel=properties.kcInputClassRadioLabel!>
|
<#assign classLabel=properties.kcInputClassRadioLabel!>
|
||||||
<#else>
|
<#else>
|
||||||
<#assign inputType='checkbox'>
|
<#assign inputType='checkbox'>
|
||||||
<#assign classDiv=properties.kcInputClassCheckbox!>
|
<#assign classDiv=properties.kcInputClassCheckbox!>
|
||||||
<#assign classInput=properties.kcInputClassCheckboxInput!>
|
<#assign classInput=properties.kcInputClassCheckboxInput!>
|
||||||
<#assign classLabel=properties.kcInputClassCheckboxLabel!>
|
<#assign classLabel=properties.kcInputClassCheckboxLabel!>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if attribute.annotations.inputOptionsFromValidation?? && attribute.validators[attribute.annotations.inputOptionsFromValidation]?? && attribute.validators[attribute.annotations.inputOptionsFromValidation].options??>
|
<#if attribute.annotations.inputOptionsFromValidation?? && attribute.validators[attribute.annotations.inputOptionsFromValidation]?? && attribute.validators[attribute.annotations.inputOptionsFromValidation].options??>
|
||||||
<#assign options=attribute.validators[attribute.annotations.inputOptionsFromValidation].options>
|
<#assign options=attribute.validators[attribute.annotations.inputOptionsFromValidation].options>
|
||||||
<#elseif attribute.validators.options?? && attribute.validators.options.options??>
|
<#elseif attribute.validators.options?? && attribute.validators.options.options??>
|
||||||
<#assign options=attribute.validators.options.options>
|
<#assign options=attribute.validators.options.options>
|
||||||
|
<#else>
|
||||||
|
<#assign options=[]>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if options??>
|
<#list options as option>
|
||||||
<#list options as option>
|
|
||||||
<div class="${classDiv}">
|
<div class="${classDiv}">
|
||||||
<input type="${inputType}" id="${attribute.name}-${option}" name="${attribute.name}" value="${option}" class="${classInput}"
|
<input type="${inputType}" id="${attribute.name}-${option}" name="${attribute.name}" value="${option}" class="${classInput}"
|
||||||
aria-invalid="<#if messagesPerField.existsError('${attribute.name}')>true</#if>"
|
aria-invalid="<#if messagesPerField.existsError('${attribute.name}')>true</#if>"
|
||||||
|
@ -185,8 +187,7 @@
|
||||||
/>
|
/>
|
||||||
<label for="${attribute.name}-${option}" class="${classLabel}<#if attribute.readOnly> ${properties.kcInputClassRadioCheckboxLabelDisabled!}</#if>"><@selectOptionLabelText attribute=attribute option=option/></label>
|
<label for="${attribute.name}-${option}" class="${classLabel}<#if attribute.readOnly> ${properties.kcInputClassRadioCheckboxLabelDisabled!}</#if>"><@selectOptionLabelText attribute=attribute option=option/></label>
|
||||||
</div>
|
</div>
|
||||||
</#list>
|
</#list>
|
||||||
</#if>
|
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
<#macro selectOptionLabelText attribute option>
|
<#macro selectOptionLabelText attribute option>
|
||||||
|
|
Loading…
Reference in a new issue